Trying to make a test average program that gets data from a file(names and score), puts it in an array and calculates using data from the array. How do I access the file and read the data?
Line 30: You don't need to open the file if you supplied a name to the ifstream constructor.
Line 32: You're overlaying the name you just read in.
Line 37: This array shadows the array at line 15. Any changes to this array won't be reflected in the array in main. You need to pass the array in main as an argument.
Lines 31-38: You need a loop to read the records from the file.
Line 43: These are uninitialized variables. You calculation at line 46 is just going to compute garbage. You don;t want to be using local variables here. You want to be using the data you read in.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.