//整型数值
int count = 5;
//字符数组型数值
char ch_count[5];
//字符串型
string str_count;
//将整型数值转换为字符数组数值
sprintf(ch_count, "%d", count);
//将字符数组存于字符串
str_count=ch_count;
每天学点C++_2.Int转String
最新推荐文章于 2024-05-22 00:03:53 发布
//整型数值
int count = 5;
//字符数组型数值
char ch_count[5];
//字符串型
string str_count;
//将整型数值转换为字符数组数值
sprintf(ch_count, "%d", count);
//将字符数组存于字符串
str_count=ch_count;