题目:
将字符串中的数字转化为整数,要求
1.不超过32位
2.无视前导空格
3.能判断正负数
题解:
1.速度极快,用流的方式赋值给n
string s1 = " -100000000000000000000000000000000";
stringstream liu(s1);
int n = 0;
liu >> n;
cout << n << endl;
快速转换32位字符串数字:无视空格与正负判断
题目:
将字符串中的数字转化为整数,要求
1.不超过32位
2.无视前导空格
3.能判断正负数
题解:
1.速度极快,用流的方式赋值给n
string s1 = " -100000000000000000000000000000000";
stringstream liu(s1);
int n = 0;
liu >> n;
cout << n << endl;

被折叠的 条评论
为什么被折叠?
