Reading (Files and Streams)

Thanksss
Last edited on
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
Thanks for replying my question actually the question looks obscure because it is originally in not that format..and if you can give me your email please so that i can send you the pdf form of the question with attached figurees as a references for the question....It is my 20% assignment question..i hope you can help me....
Edit your profile so I can send you a private message with my email address.
Done Man....
Topic archived. No new replies allowed.