The Bowling Coach of the Australian Cricket Team is preparing for a new and very busy season of international cricket. On the latest tour of South Africa he has had his laptop fail, leaving the only computing resource available to him as a computer that could run a simple C program with simple text file(s) as input. So for this season he wants to be prepared.

He needs to be able to report on team performance, particularly in this case bowling performance, and to give a comparison of bowling performances across the team. You will need to write a program that allows the coach to feed in a simple text file of individual bowling performances and produce lists that are ordered alphabetically, as well as in performance order (defined later). This program is to be available in case an equipment failure happens again.

Initially the team will consist of a squad of 15 players, but altering this to allow for more players (in a subsequent compile and run of the program) should be made as easy as possible.


In cricket, batsmen take their individual turns in the middle of the oval and score runs. Each turn in the middle is called an innings and they bat until they get out (called a completed innings). The collective score for the whole team is called the Innings Total for the team. While batters bat, bowlers from the opposing team bowl (or deliver) the cricket ball at them and try to get the batter out, as well as trying to prevent the batter from scoring runs. At the end of the innings, as well as batting details being reported for each batter in the batting team, the bowling details for each bowler in the bowling team are also reported. We will focus solely on bowling data from here on.

Across their career, or in this case just for the whole of the Australian summer, a bowler’s average is given by the total number of runs conceded, divided by the number of wickets taken (the number of batters the bowler got out). Traditionally, a bowling average is reported accurate to 2 decimal places. Another important statistic for a bowler is the strike rate which is the number of deliveries bowled (on average) for each wicket taken. This is generally reported correct to the nearest whole number (0 decimal places). If the number of wickets taken is zero then the bowler does not have an average or a strike rate to report and these are left blank in any printed report. There are some extra peculiarities on the way a bowling performance is reported. An over consists of 6 deliveries (bowling at a batter 6 times), and the amount of bowling done is measured in overs. So the number of deliveries bowled is 6 times the number of overs bowled.

Some who are familiar with cricket statistics will know that it is possible for a partialover to be bowled, but we will not worry about this – for us, a bowling performance will consist of an integer number of overs.

A maiden over is an over where the batter does not score any runs.

So an individual bowling performance is most often written as O M R W, representing the number of Overs bowled, how many of these overs were Maiden overs, the number of Runs conceded, and the number of Wickets taken.

The data input for any performance will therefore consist of the bowler’s name followed by these 4 integer quantities.

The sum of all of the individual performances so far across the summer, becomes the bowlers total performance for this season.


The bowler with the best performance across the summer is the bowler who has taken the most wickets. If two bowlers have the same number of wickets, then the bowler conceding the fewer runs is better, except in the case of a player who has not bowled any overs at all – any player that has bowled at least one over ranks ahead of any player who has not bowled at all (and has therefore conceded no runs). For players that are still considered equal after all the above conditions are met, they are sorted alphabetically on their names.


Your program will read two data files, set up in the same folder as was done for the first assignment. These data files are called input2a.dat and input2b.dat. You program should have the following steps:

  • Read the team members’ family names from the first data file and store them (wherever your program design says it is best to do so). There will be 15 names. You may then close the first file.
  • Read the second data file until end-of-file. Each data set in this file will consist of a name followed by a number of Overs Maidens Runs Wickers. It will also be possible for this file to be empty.
  • For each data set, check for data consistency. If any data item is negative the data set is invalid. If overs is less than maidens then the data is invalid. If the number of wickets is greater than 10, then the data is invalid. Any invalid data set is reported with an error message and ignored. E.g. Johnson 6 12 45 2 – data is invalid
  • For each data set, find the correct bowler in your list, add in the number of Overs Maidens Runs Wickets to that bowler’s overall performance for the summer. For each bowler, you should also keep a copy of this input data as that bowler’s latest performance. If the bowler’s name cannot be found, then the data is also invalid, whereupon it is reported as such, and then ignored. E.g. Johnsen 12 6 45 2 – name not found in team list
  • Calculate the average and strike rate of all players. If you cannot perform a particular calculation you may leave the figure as zero and then deal with this situation when the values are needed to be output.
  • Produce an alphabetically ordered list of the players and their performances overall (including average and strike rate) and their latest performance (just the O M R W values). Use an output format that will right-justify the name. If a result does not exist it can be printed as space characters.
  • Sort the list into decreasing order of bowling performance (best bowler first).
  • Produce a similar list of results to the one above, but this time, only print results for players that have bowled at least 1 over during the summer.

Observation: While it is possible to complete this assignment using a number of parallel arrays, your design will be better and easier to work with, if you define your own structured type (it is best to use our naming convention of structname_t), and then have a single array of these objects. Your design will also benefit from having a number of functions. A solution that does not have well designed functions to perform major tasks, will be marked down significantly.


Output should be produced along the following guidelines: Name should be right-justified as stated above, for the overall performance Overs Maidens Runs Wickets are generally 3 digit integers, for the latest performance the overs and runs are 3 digits and the maidens and the number of wickets are 2 digits., Average should allow for a range from 0.00 to 999.99. Strike Rate should allow for a number between 0 and 999. Use output formats that will allow normal data to be output in columns. Use headings as appropriate to display the data as a table. E.g. (the actual numbers used here are ficticious):

Team Bowling - Alphabetical Team List
Overall Latest
Name O M R W Avg S/R O M R W
Clarke 10 2 34 0 4 1 12 0
Doolan 0 0 0 0 0 0 0 0
………… etc.
Johnson 90 7 254 12 21.17 45 18 3 86 5 ………… etc.

Note that alphabetical order does not include the leading spaces that are part of the right-justification of the output of the name.

Results can then be printed in performance order as follows: Team Bowling – In Order of Performance

Overall Latest
Name O M R W Avg S/R O M R W
Johnson 90 7 254 12 21.17 45 18 3 86 5 ………… etc.


The Australian squad consists of the following 15 players: Clarke Doolan Haddin Hughes Johnson Lyon Marsh Maxwell OKeefe Rogers Siddle Smith Starc Warner and Watson.

Your program will be graded on a number of data sets, we may decide to try it out with the data for the Sri Lankan team, or the Indian team that toured South Africa recently, so you had better allow for names up to 20 characters long.

While the file containing the team list will always have 15 names, the second data file may have any number of complete data sets.

Some individual bowling performances in some matches played previously are as follows (these can be used to test your program – but you will need to make up your own data to adequately test all the required aspects of your program):

Johnson 12 6 45 2
Siddle 17 8 27 2
Johnson 25 4 98 5
Watson 15 5 57 4
Smith 9 0 40 0
Lyon 38 8 105 6
Watson 12 3 22 2
Clarke 8 1 22 0
Johnson 18 3 86 5
Starc 24 7 72 3
Clarke 4 1 12 0

It will be normal for these data to be one set of data (5 values) per line. As each match is played, extra data can then be easily added to the end of the input2b.dat file.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.