- Assignment #7 Arrays and functions Due Date: 11/30/06
- Problem: (100 points) Develop an algorithm for solving the problem described below and then write its program.
- This program must read the test grades for a group of students from an input file called indata7.txt data, curve the grades and send the result (curved grades) to a file called oudata7.txt. Grades are whole numbers.
- Assume that there could be at most data for 15 students in the input file.
- Your main( ) function must open the files, check that there are no problems opening them, and then call three functions:
- 1) GetData: reads the input data from indata7.txt into an array grades and returns it to the main function together with the quantity of grades read. It receives the input file stream variable as a parameter.
- 2) CurveData: receives the grades array and the number of grades to process, curves the grades and returns it to main(). It curves the grades by multiplying each grade by the factor 100/MAX_GRADE, where MAX_GRADE is the grade corresponding to the highest test grade.
- 3) PrintData: prints the output (curved grades) to file outdata7.txt. It receives the output file stream variable as a parameter. It also receives the modified or curved grades array and the quantity of grades to be printed.
- For example the output file will contain the following information:
- Actual Grades Curved Grades
- 88 97
- 76 84
- 69 77
- 58 64
- 75 83
- 86 96
- 74 82
- 90 100
- 84 93
- 78 87
- Finally, main() must close the files.
- IMPORTANT: since you can get less than 15 grades from the input file, your program must keep track of how many grades are read in order to work only with them when curving and printing them out.
- IMPORTANT:
- _ do not use global variables to pass information among functions.
- _ use reference and value parameters accordingly, to exchange information among the functions.
- _ before start working on the program, write on paper the algorithm to solve the problem. Distinguish clearly which are the value parameters and which are the reference parameters by understanding what must be passed from the main function to the functions and what must be passed from the functions to the main function.
- Write the algorithm in a text file and submit it along the source program (.cpp) through WebCT.
assignment7
By: polexican | Date: Dec 6 2006 18:05 | Format: None | Expires: never | Size: 2.32 KB | Hits: 1415
Latest pastes
18 hours ago
1 days ago
1 days ago
1 days ago
2 days ago