Sie sind auf Seite 1von 3

#include<iostream.

h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
struct Student
{
int rollno;
char name[20],add[30];
float m[5],tot,avg;
char grade;
};
void accept(Student s[])
{
for(int i=0;i<10;i++)
{
cout<<"\n Enter Roll No";
cin>>s[i].rollno;
cout<<"\n Enter Name";
gets(s[i].name);
cout<<"\n Enter Address";
gets(s[i].add);
s[i].tot=0;
for(int j=0;j<5;j++)
{
cout<<"\n Enter Marks of subject"<<j+1;
cin>>s[i].m[j];
s[i].tot+=s[i].m[j];
}
s[i].avg=s[i].tot/5;
if(s[i].avg>=90)
s[i].grade='A';
else if (s[i].avg>=75)
s[i].grade='B';
else if(s[i].avg>=55)
s[i].grade='C';
else if(s[i].avg>=40)
s[i].grade='D';
else
s[i].grade='E';
}
}
void Display(Student s[])
{
for(int i=0;i<10;i++)
{
cout<<"\n Roll No
"<<s[i].rollno;
cout<<"\n Name
"<<s[i].name;
cout<<"\n Address
"<<s[i].add;
for(int j=0;j<5;j++)
{
cout<<"\n Marks of subject"<<j+1;
cout<<s[i].m[j];
}
cout<<"\n Total Marks "<<s[i].tot;
cout<<"\n Average Marks "<<s[i].avg;
cout<<"\n Grade
"<<s[i].grade;
getch();
}
}
void Merit(Student s[])

{
for(int i=0;i<10;i++)
{
if(s[i].avg>=75)
{
cout<<"\n Roll No
"<<s[i].rollno;
cout<<"\n Name
"<<s[i].name;
cout<<"\n Address
"<<s[i].add;
for(int j=0;j<5;j++)
{
cout<<"\n Marks of subject"<<j+1;
cout<<s[i].m[j];
}
cout<<"\n Total Marks "<<s[i].tot;
cout<<"\n Average Marks "<<s[i].avg;
cout<<"\n Grade
"<<s[i].grade;
getch();
}
}
}
void Query(Student s[])
{
int r;
cout<<"\n Enter Rollno for query";
cin>>r;
for(int i=0;i<10;i++)
{
if(s[i].rollno == r)
{
cout<<"\n Roll No
"<<s[i].rollno;
cout<<"\n Name
"<<s[i].name;
cout<<"\n Address
"<<s[i].add;
for(int j=0;j<5;j++)
{
cout<<"\n Marks of subject"<<j+1;
cout<<s[i].m[j];
}
cout<<"\n Total Marks "<<s[i].tot;
cout<<"\n Average Marks "<<s[i].avg;
cout<<"\n Grade
"<<s[i].grade;
getch();
}
}
}
void main()
{
Student s[10];
int c;
accept(s);
do
{
cout<<"\n1. Display\n2. Merit list\n3. Query of number";
cout<<"\n4. Exit";
cout<<"\n Enter your choice";
cin>>c;
switch(c)
{
case 1:Display(s);break;

case 2:Merit(s); break;


case 3: Query(s);break;
case 4:exit(0);
default:cout<<"\n Wrong Choice";
}
getch();
}while(1);
}

Das könnte Ihnen auch gefallen