#include<iostream.h>
#include<conio.h>
#include<conio.h>
class std
{
protected:
int total,average;
public:
int rollno;
char name[12],course[23];
void getstd()
{
cout<<"Enter Student Register Number : ";
cin>>rollno;
cout<<"Enter Student Name : ";
cin>>name;
cout<<"Enter Student Course Name : ";
cin>>course;
}
void dispstd()
{
cout<<"Course Name : " <<course"\t";
cout<<"Register Number : " <<rollno"\t";
cout<<"Student Name : " <<name<<endl;
}
};
class mark
{
public:
int m1,m2,m3;
void getmark()
{
cout<<"Enter Marks : ";
cin>>m1;
cin>>m2;
cin>>m3;
}
void dispmark()
{
cout<<"\t English : "<<m1<<endl;
cout<<"\t Mathematics : "<<m2<<endl;
cout<<"\t Science : "<<m3<<endl;
cout<<"\n";
}
};
class stdmark:public std,public mark
{
public:
float total,average;
void calcstdmark()
{
total=m1+m2+m3;
average=total/3;
}
void dispstdmark()
{
cout<<"Total Marks : "<<total<<endl;
cout<<"Average : "<<average<endl;
if(average>=80)
{
cout<<"Distinction";
}
else if(average>=60)
{
cout<<"First Class";
}
else
{
cout<<"Second Class";
}
}
};
void main()
{
clrscr();
cout<<"Student Mark List"<<endl;
cout<<"----------------------"<<endl;
stdmarksm;
sm.getstd();
sm.getmark();
cout<<"\n"<<endl;
cout<<"\t OUTPUT "<<endl;
cout<<"\t ------------ "<<endl;
sm.dispstd();
sm.dispmark();
sm.calcstdmark();
sm.dispstdmark();
getch();
}
}
No comments:
Post a Comment