Football points proggy

Hello, I have a friend at work, who organises our football draw each week, he hands out a sheet for each of the 24 members to write down the scores to the matches, then, after they hand them in, he gets the results, then whoever member has the most draws on their sheet, wins. My friend, who has no programming knowledge, resorts to printing out a word document that he had edited each week:- example....

Position, Player Name, Points
1 FRED 12
1 BURT 12
2 JANE 11
3 HARRY 10
etc....etc....

My programming had rusted many years ago, but not enough to TRY and find a program code that would help make his job that little bit easier, or to get my memory back. What he needs is a short program that would prompt him to "Enter the week number", then "Enter Points for FRED, BURT, JANE etc....then after all 24 members points are entered, the list would place the winner/s in the top position on the list, then the following week, the points for that week, will add to this week. I would be forever happy if anyone could come up with some code. I remember watching the Eurovision Song contest scoreboard on TV, where after the points were entered, the country with the highest points, would bump up to the top. Many thanks, and I will give credit to anyone who has the answer to this, Steve
You will need knowledge of basic IO: http://www.cplusplus.com/doc/tutorial/basic_io/
and file IO: http://www.cplusplus.com/doc/tutorial/files/

basically your code may look like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct Player
{
  std::string player_name;
  int points;
  int week; // ?
};

std::vector<Player> players; // http://www.cplusplus.com/reference/stl/vector/

bool ReadDataFromFile(string filname,vector<Player> &players);
bool SortData(vector<Player> &players); // use std::sort to sort a vector

bool DisplayData(std::vector<Player> &players);
bool EnterData(std::vector<Player> &palyers);


I'm not sure about weeks part. Do mean that you can enter any week number and it will display results of that week?
Last edited on
Thanks for the reply Null, the weeks part would only need to be a number representing the current week of the year, ie "WEEK 7", just so he can always print out the results of that week, Steve
Your data file can be like this:

: 29
FRED 12
BURT 12
JANE 11

: 30
BURT 18
JANE 17
FRED 21

where : 29 and : 30 represent the numbers of the week.

When the user enters the number of the week, you'd search for : character, and if found check the number of the week.

Then you can read players' data until you read another : character.
Last edited on
Many thanks for your help Null, it might be enough to shift the rust from my programming brain, time will tell, Steve
Topic archived. No new replies allowed.