String类型转int类型
C语言形式:
int main()
{
string str = "123";
int i = atoi(str.c_str());
cout << i << endl;
system("pause");
return 0;
}
C++形式:
int main()
{
string str = "123";
int i = stoi(str);
cout << i << endl;
system("pause");
return 0;
}
转long类型:stol()
转float类型:stof()
转double类型:stod()