入力用に新しいファイルを開き、input >> listSize;
whileループの外側で呼び出してから呼び出しを続けるとinput >> anothervariable
、ファイルは自動的に進行しますか、それとも最初の行を再度読み取りますか?
例:
input >> listSize;
BaseStudent* studentlist = new BaseStudent[listSize.atoi()];
while (!input.eof())
{
input >> anothervariable; // I want this to start on the second line, not the first
}
入力ファイルは次のようになり、パターンにコーディングできます(余分な空白行は無視してください)。
12
Bunny, Bugs
Math 90 86 80 95 100 99 96 93
Schmuckatelli, Joe
History 88 75 90
Dipwart, Marvin
English 95 76 72 88
Crack Corn, Jimmy
Math 44 58 23 76 50 59 77 68
Kirk, James T.
English 40 100 68 88
Lewinsky, Monica
History 60 72 78
Nixon, Richard
English 35 99 70 70
Lincoln, Abraham
History 59 71 75
Clinton, William
Math 43 55 25 76 50 58 65
Duck, Donald
English 34 100 65 65
Duck, Daffy
History 55 70 70
Bush, George
Math 44 54 29 75 50 55 60