标签:
int to string
#include<iostream> #include<string> using namespace std; int main() { string s; char c[100]; int m=199; itoa(m,c,10); s=c; s.insert(0,"zhang"); cout<<s<<endl; return 0; }
string to int
#include<iostream> #include<string> using namespace std; int main() { string s="56sd"; int a=atoi(s.c_str()); cout<<a<<endl; return 0; }
C++中将int转变成string和string转变成int
标签:
原文地址:http://www.cnblogs.com/xiaovlxx/p/4508907.html