The question appears to be intentionally obscure. That's okay: that's now it works in the real world.
You have to figure out what you can ignore here and what's important. You're task is summarized in the last two sentences: "Write a C++ program that reads the records from output.txt file and finds the winner of the competition. The program should display the university’s name and the total points scored."
So all you care about is output.txt, which, from your prespective is the
input file. You don't really care how the file is generated. What you need to know is
what is the format of output.txt? That doesn't seem to be specified, at least not in the what you've posted. Find out what that format is and post it, preferably with an example.
Some pseudocode for the solution:
1 2 3 4 5 6 7 8 9 10
|
struct Record; // This has all the data for one record in output.txt
ifstream in("output.txt");
Record best, current;
while (in >> current) {
if (current.totalPoints > best.totalPoints) {
best = current;
}
}
cout << best << '\n';
|
In addition, you will need to write
- constructor for Record;
-
>>
and
<<
operators for Record