CS 2401 Assignment #1

Due Date: Friday, June 15, 2012.

Objective: The goal of this assignment is to refresh your memory of 1-dimensional arrays, in preparation for the following lab on multi-dimensional arrays.

Background: The 2012 Olympic Games are about to start. Let us help journalists writing about the Games prepare the lists of winning countries.

Assignment: The results of different olympic competitions arrives in a form of a text file. Each line of this text file contains four names separated by commas:

Let us assume that the input file contains no more than 20 lines.

You should print an error message and terminate if there are not exactly three numbers on each line, and exactly 7 lines overall.

Your program should read the data from the file into four separate arrays:

Your program should ask the user for the name of his or her country, and return, for this country, the total number of gold, silver, and bronze medals, as well as the total number of medals won by this country. End the resulting message with "Go (name of the country)!": e.g., "Go USA!" or "Go Mexico!" (or "Go Russia!" :-).

Example input file:

lassoing, USA, Mexico, Canada
samba dancing, Mexico, Argentina, Brazil
rodeo clowning, USA, Mexico, Japan
ice swimming, Russia, Canada, Greenland
For this file, when asked about Mexican medals, your program should reply that Mexico won 1 gold medal, 2 silver medals, and 0 bronze medals, to the total of 3 medals.

Deliverables: Your TA will instruct you.