using namespace std;
struct student
{
string name;
int rollnumber;
int sub[3];
};
int main()
{
student st[5];
for (int i = 0; i < 5; i++)
{
system("cls");
cout<<"Enter name and roll number for student "<<i+1<<" : ";
cin>>st[i].name>>st[i].rollnumber;
for(int j = 0; j < 3; j++)
{
cout<<"Enter marks of student "<<i+1<<" for subject "<<j+1<<" : ";
cin>>st[i].sub[j];
}
}
system("cls");
cout<<"Details of students who got more than 75 mark \n\n";
for (int i = 0; i < 5; i++)
{
if ((st[i].sub[0] > 75) || (st[i].sub[1] > 75) || (st[i].sub[2] > 75))
{
cout<<"Student "<<i+1<<endl;
cout<<"Name : "<<st[i].name<<endl;
cout<<"Roll number : "<<st[i].rollnumber<<endl;
for (int j = 0; j < 3; j++)
cout<<"Mark of "<<j+1<<" subject : "<<st[i].sub[j]<<endl;
cout<<"\n\n";
}
}
system("pause");
return 0;
}
Comments