读书人

请教一个类型转换的有关问题?请大神们

发布时间: 2012-08-15 16:57:16 作者: rapoo

请问一个类型转换的问题?请大神们进来看看把....
c++

string ss="11,22,33,44,55,66,77";

怎么样快速的把上面string类型转成int[]类型.

结果期望:int[0]=11;int[1]=22;int[2]=33;int[3]=44;int[4]=55;int[5]=66;

我知道方法有很多,有没有比较快速的?

[解决办法]

探讨
C/C++ code

#include <iostream>
#include <string>
#include <sstream>
//////////////////////////////////////////////////////////////////////////
//just for unit test
#include <vector>
////////……

[解决办法]
探讨

C/C++ code


#include <stdio.h>
#include <string>

using namespace std;

int main(void)
{
int num[10] = {0};
int num_offset = 0;
string ss="11,22,33,44,55,66,77";
char rule[] = ",";
……

读书人网 >C++

热点推荐