类型转换

整型转字符串:

int c=100;
string s=to_string(c);
cout<<s<<endl;

字符串转整型:

string s="10000";
int c=atoi(s.c_str());
cout<<c<<endl;

 

posted @ 2022-02-02 00:07  XA科研  阅读(14)  评论(0编辑  收藏  举报