1、to_string
包含在# include
int a = 4; double b = 3.14; string str1, str2; str1 = to_string(a); str2 = to_string(b); cout << str1 << endl; cout << str2 << endl;
2、stoi和atoi
包含在#include
string s1("1234567");
char* s2 = "1234567";
int a = stoi(s1);
int b = atoi(s2);
int c = atoi(s1.c_str());
cout << a << endl;
cout << b << endl;
cout << c << endl;



