As kooth wrote, it seems like the ListType structure is meant for storing the student info. You are storing it in an array you created in _tmain() instead.
If this is correct try:
1 2 3 4 5
|
struct ListType
{
int length;
Student info[MAX_ITEMS];
}; ListType list;
| |
instead of:
1 2 3 4 5
|
struct ListType
{
int length;
int info[MAX_ITEMS];
}; ListType list;
| |
Omit the for loop on line 42 - that's what the while loop is for. Increment list.length in the loop.
You may also want to modify the condition in the while loop (line 41) to check for array size reached as well as !in.eof(). Your array size is MAX_ITEMS.
Actually, as I look further at your code it looks more and more like a mess of confusion:
1) The prototypes for readstudent() and writestudent() don't match the definitions.
2) You are probably supposed to be using the readstudent() for getting the data from the file. Call this function in place of your code lines 44-50. This function should be taking a Student& instead of an ItemType& as an argument. The variable name in the function should be aStudent, not student. Pass list[list.length] to the function when you call it in the while loop.
3) What is struct ItemType supposed to be for?
4) The writestudent() is probably supposed to be doing what lines 57-63 are doing.
Hope that gets you going in a better direction!