Create a file containing 20 exams scores ( ranging from 0-100 ). Write a program to read the file, calculate and output the average exam score to the screen. Use a 1 dimensional array to hold the exam scores.
I need help coming up with a program with this because this is my first time ever using arrays and it just does not make any sense to me at all. Please! Can someone help me ??
What you do is create 20 exam scores and file them.
Hint: the array will need 20 elements and the average is the total of all the 20 divided by 20. Use floats because integer division will give you bad/misleading average.
arrays? Read this if your class notes and textbook fail:
http://www.cplusplus.com/doc/tutorial/arrays/
Come back with some code is best way to get more help:)
In the same way that you loop through the array to populate it, loop through it again to sum up the contents. Initialize a variable to 0 and add the contents of each array element to it.