#include<iostream.h>
#include<conio.h>
class pupil
{
int rn;
public:
void putno(int);
void getno(void);
};
void pupil::putno(int r)
{
rn=r;
}
void pupil::getno()
{
cout<<"\n Roll Number: "<<rn;
}
class marks:public pupil
{
public:
int guj,eng;
void putmarks(int,int);
void getmarks(void);
};
void marks::putmarks(int m1,int m2)
{
guj=m1;
eng=m2;
}
void marks::getmarks()
{
cout<<"\n Marks Of Gujarati: "<<guj;
cout<<"\n Marks Of English: "<<eng;
}
class result:public marks
{
int total,avg;
public:
void display(void);
};
void result::display()
{
total=guj+eng;
avg=total/2;
getno();
getmarks();
cout<<"\n Total Marks: "<<total;
cout<<"\n Average Marks: "<<avg;
}
void main()
{
clrscr();
result r1;
r1.putno(331);
r1.putmarks(95,95);
r1.display();
getch();
}
#include<conio.h>
class pupil
{
int rn;
public:
void putno(int);
void getno(void);
};
void pupil::putno(int r)
{
rn=r;
}
void pupil::getno()
{
cout<<"\n Roll Number: "<<rn;
}
class marks:public pupil
{
public:
int guj,eng;
void putmarks(int,int);
void getmarks(void);
};
void marks::putmarks(int m1,int m2)
{
guj=m1;
eng=m2;
}
void marks::getmarks()
{
cout<<"\n Marks Of Gujarati: "<<guj;
cout<<"\n Marks Of English: "<<eng;
}
class result:public marks
{
int total,avg;
public:
void display(void);
};
void result::display()
{
total=guj+eng;
avg=total/2;
getno();
getmarks();
cout<<"\n Total Marks: "<<total;
cout<<"\n Average Marks: "<<avg;
}
void main()
{
clrscr();
result r1;
r1.putno(331);
r1.putmarks(95,95);
r1.display();
getch();
}
No comments:
Post a Comment