[讨论]怎么把字符串转换成数组???
/* example of vector//: C02: 01.cpp
//Copy an entire file into a vector of string
#include <string>
#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
int main()
{
vector<string> v;
ifstream in("Fillvector.cpp");
string line;
while(getline(in,line))
{
v.push_back(line);//Add the line to the end
//Add line number
}
for (int i = 0; i < v.size(); i++)
{
cout << i << ": " << v[i] << endl;
}
}///:~
这个是程序,注意红色的部分..
line 是string类型的
有没有可能把它转化成一个数组?假设line中的字符全为数字或者字母.....