Take a look at the code for me?

I have this gradebook program that can do these things:
1) show all grades for a student
2) calculate the average for a student
3) list all students below the class average
4) list all students above the class average
5) enter all grades for a student
6) register a new student for the class and enter all the student's grades
7) exit
Supposedly. it I have my code, and I was wondering if someone would be able to take a look and find my errors. There is at least one, but I have spent 3-4 days digging through it and they elude me.
Some problems I know about are in file I/O and determining who is above average and who is below average. When trying to read to a file I wrote to in this program it doesn't get anything and most times errors and says was unable to read. When trying to write to a file, a lot of times it just writes a bunch of zeroes or nothing at all.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <iostream>
#include <fstream>
#include "gradebook.h"

using namespace std;

int main()
{
	int again = 0;
	char students[100][40];
	int num_students = 0;
	int quizzes[100][5];
	int tests[100][2];
	int assignments[100][4];
	char student[40];
	char filename [30];
	ifstream infile;
	int choice;
	
	cout << "***********************" << endl
		 << "*  G R A D E B O O K  *" << endl
		 << "***********************" << endl;
	
	read_grades_from_file(students, num_students, quizzes, tests, assignments);

do
{
	cout << "Menu" << endl
		 << "----" << endl
		 << "1) show all grades for a student" << endl
		 << "2) calculate the average for a student" << endl
		 << "3) list all students below the class average" << endl
		 << "4) list all students above the class average" << endl
		 << "5) enter all grades for a student" << endl
		 << "6) register a new student for the class and enter all the student's grades" << endl
		 << "7) exit" << endl
		 << "Please make your choice: ";
	cin >> choice;
	while (choice > 7 || choice < 1)
	{
		cout << "That is an invalid menu choice. Please choose again: ";
		cin >> choice;
	}
	if (choice == 1)
	{
		cout << "Please enter the name of the student: " << endl;
		cin >> student;
		int index = find_student(students, num_students, student);
		cout << student << "'s quiz grades are:" << endl;
			for (int j = 0; j < 5; j++)
			{
				cout << quizzes[index][j];
				cout << " ";
			}
		cout << endl << student << "'s test grades are:" << endl;
			for (int j = 0; j < 2; j++)
			{
				cout << tests[index][j];
				cout << " ";
			}
		cout << endl << student << "'s assignment grades are:" << endl;
			for (int j = 0; j < 4; j++)
			{
				cout << assignments[index][j];
				cout << " ";
			}
		int average = calculate_average(quizzes[index], tests[index], assignments[index]);
		cout << endl << "The average is: " << average;
		cout << endl << "The letter grade is: " << get_grade_letter(average);
	}
	if (choice == 2)
	{
		cout << "Please enter the name of the student: " << endl;
		cin >> student;
		int index = find_student(students, num_students, student);
		cout << calculate_average(quizzes[index], tests[index], assignments[index]);
	}
	if (choice == 3)
	{
		list_students_below_average(students, num_students, quizzes, tests, assignments);
	}
	if (choice == 4)
	{
		list_students_above_average(students, num_students, quizzes, tests, assignments);
	}
	if (choice == 5)
	{
		char student[40];
		int index;
		cout << "Which student would you like to enter grades for?" << endl;
		cin >> student;
		index = find_student(students, num_students, student);
		cout << "Please enter 5 quiz grades, 2 tests, then 4 assignments.";
		for (int i = 0; i < 5; i++)
		{
			int grade;
			cin >> grade;
			int j = (index + 1 + i);
			quizzes[index][j] = grade;
		}
		for (int i = 0; i < 2; i++)
		{
			int grade;
			cin >> grade;
			int j = (index + 1 + i);
			tests[index][j] = grade;
		}
		for (int i = 0; i < 4; i++)
		{	int grade;
			cin >> grade;
			int j = (index + 1 + i);
			assignments[index][j] = grade;
		}
	}
	if (choice == 6)
	{
		add_student(students, num_students, quizzes, tests, assignments);
	}
	if (choice == 7)
		break;
	cout << "Type in 1 to continue with the program and 0 to exit";
	cin >> again;
}
while (again);
write_grades_to_file(students, num_students, quizzes, tests, assignments);
}

Topic archived. No new replies allowed.