#include
#include
using namespace std;
class student
{
private: char name[20];
int usn;
int m1,m2,m3;
float avg;
public: void read();
void show();
float average();
};
void student :: read()
{
cout<
cin>>usn;
cout<<"Enter student name:";
cin>>name;
cout<<"Enter marks in 3 subjects:";
cin>>m1>>m2>>m3;
}
float student :: average()
{
if(m1
avg=float((m2+m3)/2);
else if(m2
avg=float((m1+m3)/2);
else
avg=float((m1+m2)/2);
return avg;
}
void student :: show()
{
cout<
}
int main()
{
student s[20];
int i, n;
cout<
cin>>n;
for(i=0;i
s[i].read();
cout<
cout<
for(i=0;i
{
s[i].average();
s[i].show();
}
return 0;
}
No comments:
Post a Comment