Array reference problem

I'm not sure but i believe my problem comes from using an array. I input 5 scores for 20 students and then display their totalGPA but i keep getting infinite numbers and i cant figure out where the problem is. So i assume im not using the array right and it cant figure out what number to use.

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
int main ()
{

	double GP[20][5];
	double totalGPA;


	//Inputs the grade point for the five classes for 20 students
	cout << "Enter the grade point for the 20 students (X X X X X)" << endl;
	for (int i=0; i<20; i++)
	{
		
		for (int j=0; j<5; j++)
		{
			//cin >> num1;
			cin >> GP[i][j];
		}
	}

		for (int a=0; a<20; a++)
		{
			for (int b=0; b<5; b++)
			{
				if (GP[a][b] >= 90)
				{
					totalGPA += 4.0;
				}
				else if (GP[a][b] >= 80)
				{
					totalGPA += 3.5;
				}
				else if (GP[a][b] >= 70)
				{
					totalGPA += 3.0;
				}
				else if (GP[a][b] >= 60)
				{
					totalGPA += 2.5;
				}
				else 
					totalGPA += 0;
			}
			x++;
			cout << totalGPA << endl;
		}
		
	system ("pause");
	return 0;
}



Im sure is something small but i cant find it.
initialise totalGPA to 0
thanks that worked, i knew it was something like that. thanks again
Topic archived. No new replies allowed.