我的測試文件中有數據是這樣的:C++從文本文件顯示幫助輸入
1
2
3
0
1, 2
3, 4
0, 0
4, 3
2, 1
0, 0
我怎麼會通過線路的數據分開,但分開也由零數據的每個部分。
ifstream data("testData.txt");
string line, a, b;
while(getline(data,line))
{
stringstream str(line);
istringstream ins;
ins.str(line);
ins >> a >> b;
hold.push_back(a);
hold.push_back(b);
}
如何將它們分隔爲零?
做些什麼......?做什麼?你的預期產出是多少? – Extrakun 2009-07-23 03:27:46