I need help trying to write a program using arrays and for loops for a grades. I have to use an input file for the actual data but need help with a outline or skeleton of the program. Im really new to C++ and would like some help. Anything would be greatly appreciated. Thanks in advance.
Student Number Number Correct PASS/FAIL
1 6 FAIL
2 3 FAIL
3 19 PASS
4 23 PASS
5 7 FAIL
It depends slightly on how your input file is. If you know that it has 5 numbers in it, you'll use a int data[5] and a simple for loop to read the numbers. If the number of entries is the first number in the file, you'll either have to allocate the array dynamically (which might be hard, if you're not familiar with that) or just use a really big one, and a variable showing how many elements are shown. Lastly, if the input file may contain any number of entries, you can't decide how long your array needs to be so you will have to use a really big one (although a linked list would be more appropriate). Also, you'd need a while(myfile >> myarray[mycount]) mycount++; loop.