注册 登录
编程论坛 C++教室

[求助]长整型转C++string

三少爷 发布于 2004-05-25 16:15, 3115 次点击

我知道C++string 如何转 C string

整数如何转C string

但是就不知道长整型数转成 C++ string

哪位大侠知道望告知,感激不尽。

6 回复
#2
C++大粉丝2004-05-25 19:00
#include <iostream>
#include <string>
using namespace std;
#define STR(B) B
#define UINT(A) A;
#define TOTAL(B,C,A) C=A;\
if (C == A){B=#A;};
int main()
{
 unsigned long uil = 10000;
 string str;
 TOTAL(str,uil,10000);
 cout << str << endl;
 return 0;
}
#3
C++大粉丝2004-05-25 19:01
string的函数我查遍了,没有找到,只好.....
#4
kai2004-05-26 08:34

#include <cstdlib> #include <iostream> #include <sstream>

using namespace std;

int main() { long test = 2147383648; stringstream sout; string s;

sout << test; s = sout.str(); cout << s << endl;

system("pause"); return 0; }

#5
三少爷2004-05-26 22:50

多谢两位大侠

程序员斑竹的比较高深,

kai斑竹的简单易懂

#6
C++大粉丝2004-06-16 21:48

我看重效率.

#7
yxieguodong2011-04-18 23:47
学习了学习了
1