IUP Computer Science
CO 110 Spring 2000

Project #6
(Due 5 pm 28 April 2000)

A bunch of kids decided to go bowling one day; but they happened to arrive at the bowling alley on a day that the computer which did automatic scoring was broken. So, they appointed Hayden, who was the youngest, to keep score. Hayden didn't know how to keep score; so he just wrote down the number of pins each person knocked down each time s/he rolled the ball. The kids then typed this information into a file when they returned home; and now they want you to write a program to figure out their bowling scores.

The file has one line for each bowler. The first line of the file contains a single number that indicates how many bowlers there were. After that, each line has the following form.

name  #rolls  list-of-number-of-pins-knocked-down
The file SAMPLE.TXT is provided in the jlwolfe folder of the I: drive to show you what such a file looks like. That file has the following contents.
4
Madeline  18  7 1 8 2 5 4 10 6 3 10 10 7 2 6 2 8 2 7
Alison    17  9 0 10 1 8 8 1 6 4 6 2 7 3 10 10 5 4
Bobby     17  6 3 9 1 8 0 4 4 10 8 2 9 0 10 10 7 2 
Brandon   19  10 8 0 7 2 3 4 8 2 9 1 5 3 7 0 9 1 9 0
This indicates that there were 4 kids and that Madeline rolled the ball 18 times and got 7 pins the first time, 1 pin the second, etc. Each kid's name consists of a just a single-word first name. The maximum number of times the ball can be rolled in a game of bowling is 21; the minimum number of times is 12. Your program is to perform three basic tasks; other requirements are on the back.
  1. Read in the information about a bowler, calculate the frame-by-frame score for that person, and store the bowler's name and frame-by-frame score.
  2. Compare all bowlers' scores one frame at a time and determine who was leading after each frame. Display the leader after each frame by showing that person's name and frame score.
  3. Sort the information about the bowlers based on the overall score (value in frame 10) and list the bowlers in order from highest to lowest - show the name and overall score.
Hand in a floppy disk containing the .cpp file and the .exe file (found in the Debug folder). Also, hand in a printout of the .cpp file (your source program). Name these files after yourself. If I were submitting, I sould name the files WOLFE.CPP and WOLFE.EXE.

SPECIFIC PROGRAM REQUIREMENTS:
  1. Your program must prompt for and read in the name of the file containing the bowling information. The program must be able to use any file specified that is in the same folder as the source file (whatever that folder may be). SAMPLE.TXT is only a sample of the bowling information; I will execute your program on a much larger file of bowling information - although there will be no more than 25 bowler's information in it.
  2. Your program must use at least one two-dimensional array (or an array of arrays, or an array of structs containing array elements).
  3. Your program must use at least three functions (including main); and you must document these functions in the style of the book (or style guide).
  4. Your program must deal with each bowler's name as a string, reading it in and displaying is as a string and not using a loop that deals with one character at a time.
  5. Your program must define at least one data type (using typedef).
  6. The output form for the results must be readable, with labels on values and having a neat appearance. Your output does not have to look like mine to be readable.
  7. Your program must place the following statement just before the return 0; statement in main: #include "endtest.h" This file contains statements which request you to enter a character before the program ends. I will be executing your program outside the Visual environment; without including endtest.h, the output window will close before I can get a chance to read it. You will find endtest.h in the jlwolfe folder on the I: drive. Copy it to the folder that holds your .cpp file and keep it with the .cpp file.
  8. You should create some more complex data and test your program with a file other than just SAMPLE.TXT.
The output that my program produces for the information in SAMPLE.TXT is shown below.
What is the file name? sample.txt

Leader after 1 is Brandon with 18
Leader after 2 is Alison with 28
Leader after 3 is Alison with 37
Leader after 4 is Madeline with 51
Leader after 5 is Bobby with 63
Leader after 6 is Madeline with 87
Leader after 7 is Madeline with 106
Leader after 8 is Bobby with 118
Leader after 9 is Bobby with 137
Leader after 10 is Bobby with 146

Score     Kid's Name
  146     Bobby
  145     Alison
  140     Madeline
  119     Brandon
Please enter a character to end: