arrays show wrong computation

I'm trying to find the grade average using 2 dimensional arrays but the computations are always wrong. It's like they're off by only a tiny bit but they're pretty close to the answers I get using the calculator. Program works fine except for this single detail and it's driving me nuts! Can you please help me?

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
#include<iostream.h>
#include<conio.h>
#define no_stud 100
main()
{
	char name[no_stud][10], passed=0, failed=1;
	double result[no_stud][5];
	int num;

	clrscr();
	cout<<"Number of students to be entered in the program: ";
	cin>>num;

	clrscr();
	gotoxy(7,1);
	cout<<"NAME";
	gotoxy(20,1);
	cout<<"QUIZ AVE";
	gotoxy(33,1);
	cout<<"MIDTERM";
	gotoxy(45,1);
	cout<<"FINAL";
	gotoxy(55,1);
	cout<<"GRADE";
	gotoxy(65,1);
	cout<<"REMARK";

	for(int n=0; n<num; n++)
	{
		gotoxy(1,n+2);
		cout<<n+1<<". ";
		cin>>name[n];
		gotoxy(23,n+2);
		cin>>result[n][0];
		gotoxy(36,n+2);
		cin>>result[n][1];
		gotoxy(47,n+2);
		cin>>result[n][2];
		gotoxy(57,n+2);
		cout<<result[n][3];
		gotoxy(65,n+2);
		if(result[n][3]>=75)
		{
			result[n][4]=passed;
			cout<<"PASSED";
		}
		else
		{
			result[n][4]=failed;
			cout<<"FAILED";

		}

	       result[n][3]=result[n][0]*.01*30+result[n][1]*.01*30+result[n][2]*.01*40;

	}

	getch();
	return 0;
}
Could you give an example of some input, what you get as output, and what you are thinking you should get?
Topic archived. No new replies allowed.