输入文件c ++读取错误

时间:2014-11-19 21:11:34

标签: c++

我想从一个看起来像这样的file.txt中读取:

process_id run_time arrival_time

T1 23 0

T2 75 5

然后我将保存在数组中

我的问题是:第一次迭代输出:T 1 2,那是不正确的

有什么帮助吗?感谢

while (!ManageFile.eof()) 
{


    ManageFile>>rubbish; //read the word process_id
    ManageFile>>rubbish; //read the word run_time
    ManageFile>>rubbish; //read the word arrival_time

    while (true) 
    {
    ManageFile>>process_id[i];
    cout << process_id[i]<<endl;
    ManageFile>>run_time[i];
    cout << run_time[i]<<endl;
    ManageFile>>arrival_time[i];
    cout << arrival_time[i]<<endl;
    i++;
    }

0 个答案:

没有答案