首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

请教一个类型转换的有关问题?请大神们进来看看把.

2012-08-15 
请问一个类型转换的问题?请大神们进来看看把....c++string ss11,22,33,44,55,66,77怎么样快速的把上面

请问一个类型转换的问题?请大神们进来看看把....
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[] = ",";
……

热点排行