Example
#include<iostream.h>
#include<conio.h>
class stud
{
protected:
char rno[10];
int m1,m2,m3;
public:
void getdata()
{
cout<<"ENTER ROLLNO MARKS1 MARKS2 MARKS3 OF STUDENT::";
cin>>rno>>m1>>m2>>m3;
}
};
class result:public stud
{
int total;
float per;
public:
void display()
{
total=m1+m2+m3;
per=total/3;
cout<<"ROLLNO MARKS1 MARKS2 MARKS3 TOTAL PER"<<endl;
cout<<rno<<"\t"<<m1<<"\t"<<m2<<"\t"<<m3<<"\t"<<total<<"\t"<<per;
}
};
int main()
{
clrscr();
result s;
s.getdata();
s.display();
getch();
return 0;
}
/*=============================================================
OUTPUT
ENTER ROLLNO MARKS1 MARKS2 MARKS3 OF STUDENT::08mca23
44
55
66
ROLLNO MARKS1 MARKS2 MARKS3 TOTAL PER
08mca23 44 55 66 165 55
*/
#include<iostream.h>
#include<conio.h>
class stud
{
protected:
char rno[10];
int m1,m2,m3;
public:
void getdata()
{
cout<<"ENTER ROLLNO MARKS1 MARKS2 MARKS3 OF STUDENT::";
cin>>rno>>m1>>m2>>m3;
}
};
class result:public stud
{
int total;
float per;
public:
void display()
{
total=m1+m2+m3;
per=total/3;
cout<<"ROLLNO MARKS1 MARKS2 MARKS3 TOTAL PER"<<endl;
cout<<rno<<"\t"<<m1<<"\t"<<m2<<"\t"<<m3<<"\t"<<total<<"\t"<<per;
}
};
int main()
{
clrscr();
result s;
s.getdata();
s.display();
getch();
return 0;
}
/*=============================================================
OUTPUT
ENTER ROLLNO MARKS1 MARKS2 MARKS3 OF STUDENT::08mca23
44
55
66
ROLLNO MARKS1 MARKS2 MARKS3 TOTAL PER
08mca23 44 55 66 165 55
*/
No comments:
Post a Comment