int转换为string

来源:互联网 发布:如何进行网络购物 编辑:程序博客网 时间:2024/05/11 03:02

#include <iostream>#include <string>using namespace std;void main(){int a = 20;char buf[10];string str;sprintf(buf, "%d", a);str = buf;cout << str << endl;cout << str.length() << endl;system("pause");}

0 0