我需要一些编程帮助。我写了下面的代码,但是我的老师说在读数据文件时我需要使用2 for循环。我不知道该怎么做......有什么建议吗?将1个C++循环转换为2个
我的代码:
ifstream infile;
infile.open("dive.txt");
for(int i = 0; i <= 6; i++)
infile >> contestantNames[i][0] >> contestantNames[i][1] >> judgeScores[i][0] >> judgeScores[i][1] >> judgeScores[i][2] >> judgeScores[i][3] >> judgeScores[i][4] >> judgeScores[i][5] >> judgeScores[i][6] >> judgeScores[i][7];
infile.close();
你的老师可能希望你使用两个嵌套循环,而不是手动从0到7。 – thkala 2010-12-06 04:02:06
你可以请你提供100个参赛者的例子吗? (with`contestantNames [100] [100]`) – ruslik 2010-12-06 04:02:42