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; }
时间: 2024-12-21 23:58:17