#include <iostream>
#include <string>
using namespace std;
int main(){
int i = 12345;
// sprintf转char*再转string
int max_length = 80;
char *chars = new char[max_length];
sprintf(chars, "%i", i);
string str = string(chars);
// to_string
string res = to_string(long long(i));
int ttt = 0;
return 0;
}
整数转字符串
最新推荐文章于 2024-06-20 10:45:19 发布