Fall2009-assignment4

Fall2009-assignment4 - Programming Systems Design CSCI 455...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 455 FALL 2009 Dr. K. Narayanaswamy Programming Assignment # 4 Due Date: 10/4/2009 (11:59:59 p.m.) Goal This assignment requires you to understand how to declare and manipulate multi-dimensional arrays in C++. You will have to also learn to design and use functions in C++ using the general style of the examples done in class, including declaration of by-value and by-reference parameters. Task Your program will be used to read votes coming in for different candidates from different polling places within a city, add them up, and provide a voting report that describes how many votes were received by each candidate within each city, total votes per candidate across all cities, total votes per city across all candidates, and the overall winner of the race. Your program should ask for an input file name and an output file name. The format of the input file is provided below. ALL the output corresponding to the voting report (described above and see the sample below) should be written to the output file. You may ask for the output file name either after you have all the data computed or before –that is up to you. The input file contains a set of exactly 10 names of cities on the first line. The second line will contain the names of 5 candidates. Following that, there will be an indefinite number of lines. Each line will have 3 entries: the first is a string, which is the name of a candidate, the second is also a string, representing the name of a city, and the third is an integer, representing the number of votes. Each input line essentially shows you that a particular candidate received a certain number of votes within a precinct within that city. Your program must read and process ALL the lines in the input file. As you read each line of input, your program should add the votes reported for that city and candidate to the table, thereby maintaining a running total of the number of votes received by each candidate in different cities. In processing each input line, if either the candidate name or the city name does not match the information about the cities on the 1 st line or the candidates on the 2 nd line respectively, the problem should be REPORTED TO THE TERMINAL so that the user knows about the problem. See the sample input and output files and the sample terminal transcript.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Fall2009-assignment4 - Programming Systems Design CSCI 455...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online