Description
Updating the Snowball Fight Program (Program 1)
Update your first program to dynamically allocate the id, hits, and times hit arrays. The number of items will be the first number in the updated “snowball_2.txt” data file. A sample file is shown below, but the file I test your program with will be larger.
3
182 37 12
837 14 25
374 29 28
Your program should read the first number in the file, then dynamically allocate the arrays, then read the data from the file and process it as before. The Unit 3 Video Notes include an example of a readFile function that does this. It is in the Program 3 section.
Define the array pointers in main and pass them into your “read data” function by reference so that the addresses stored into them go back to main and can be used by the rest of the program.
Demonstrate your pointer prowess by converting your array notation to pointer notation in the “read data” function for this revised program.
Design your program by updating the design that you made for Program 1. Update the necessary structure chart, function prototypes, and time estimates.
Save the design in a file named SnowFight2_xxx.doc where xxx are your initials. Submit your program design in the Program 3 Design drop box by the due date shown in the calendar and drop box tools.
Write your program.
Save your program in a file named snowFight2_xxx.cpp where xxx are your initials.
Compile, run and test your program.
Update the structure chart & function descriptions in your Program Design Document to fit your working program. Add the final times with the time that you actually spent on your program.
Submit your final Program Design document and working .cpp file in the Program 3 drop box by the due date shown in the calendar and drop box tools.