I`m new in Programming stuffs.
So here is my codes:
#include<iostream.h>
#include<conio.h>
float records[5][5];
float ave;
int ctrX, ctrY;
main()
{
clrscr();
ctrY=0;
for(ctrX=0;ctrX<=4;ctrX++)
{
cout<<"Student Number: ";
cin>>records[ctrX][ctrY];
ctrY++;
do {
cout<<"Quiz 1 Score: ";
cin>>records[ctrX][ctrY];
if ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30))
{
cout<<"The score supplied must be from 0 to 30 only!" <<endl;
}
} while ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30));
ctrY++;
do {
cout<<"Quiz 2 Score: ";
cin>>records[ctrX][ctrY];
if ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30))
{
cout<<"The score supplied must be from 0 to 30 only!" <<endl;
}
} while ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30));
do {
cout<<"Quiz 3 Score: ";
cin>>records[ctrX][ctrY];
if ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30))
{
cout<<"The score supplied must be from 0 to 30 only!" <<endl;
}
} while ((records[ctrX][ctrY]<0)||(records[ctrX][ctrY]>30));
}
for (ctrX=0;ctrX<=4;ctrX++) {
ctrY=1;
ave=(records[ctrX][ctrY] + records[ctrX][ctrY++] + records[ctrX][ctrY++]) / 3;
}
getch();
return 0;
}
My problem is, this code must display it in a column form. Then, I cannot display also the average.
Any comments / help will do.
Thanks in Advance!