#include<iostream.h>
#include<conio.h>
struct student
{
int rn;
int sub[3];
int av;
}res;
student input(student x[ ], int y);
void display(student x[ ], int y);
void main()
{
student m[100];
int n,i;
clrscr();
cout<<"\n How many students in the class: ";
cin>>n;
cout<<"\n Enter the data:";
for(i=0;i<n;i++ )
{
m[i]=input(m, i);
}
display(m,n);
getch();
}
student input(student m[ ], int i)
{
int j;
float tm=0;
cout<<"\n Enter Rollno and marks :";
cin>>m[i].rn;
for( j=0;j<3;j++ )
{
cin>>m[i].sub[j];
tm= tm+m[i].sub[j];
}
m[i].av=tm/3;
j=0;
return m[i];
}
void display(student m[ ], int n)
{
int j,k;
cout<<"\n RESULT IS:";
cout<<"\n ROLLNO 1 2 3 Average of Marks";
for(j=0;j<n;j++ )
{
cout<<m[j].rn<<"\t";
for(k=0;k<3;k++ )
{
cout<<m[j].sub[k]<<" ";
cout<<"\t" <<m[j].av<<endl;
}
}
return;
}