/******** IMPLEMENTATION OF HYBRID INHERITANCE ********/
#include< iostream.h>
#include< conio.h>
class student
{
private :
int rn;
char na[20];
public:
void getdata()
{
cout< < "Enter Name And Roll No : ";
cin>>na>>rn;
}
void putdata()
{
cout< < endl< < na< < "\t"< < rn< < "\t";
}
};
class test : public student
{
protected:
float m1,m2;
public:
void gettest()
{
cout< < endl< < "Enter your marks In CP 1 And Cp 2 :";
cin>>m1>>m2;
}
void puttest()
{
cout< < m1< < "\t"< < m2< < "\t";
}
};
class sports
{
protected:
float score;
public:
void getscore()
{
cout< < endl< < "Enter your score :";
cin>>score;
}
void putscore()
{
cout< < score< < "\t";
}
};
class results : public test , public sports
{
private :
float total;
public :
void putresult()
{
total = m1+m2+score;
cout< < total;
}
};
void main()
{
results s[5];
clrscr();
for(int i=0;i< 5;i++)
{
s[i].getdata();
s[i].gettest();
s[i].getscore();
}
cout< < "______________________________________________"< < endl;
cout< < endl< < "Name\tRollno\tCP 1\tCP 2\tScore\tTotal"< < endl;
cout< < "----------------------------------------------"< < endl;
for(i=0;i< 5;i++)
{
s[i].putdata();
s[i].puttest();
s[i].putscore();
s[i].putresult();
}
cout< < endl< < "----------------------------------------------";
getch();
}
/********** OUTPIUT **********
Enter Name And Roll No : Lionel
1
Enter your marks In CP 1 And Cp 2 :45
Enter your score :45
Enter Name And Roll No : Cyril
65
Enter your marks In CP 1 And Cp 2 :49
42
Enter your score :45
Enter Name And Roll No : Mayank
40
Enter your marks In CP 1 And Cp 2 :41
43
Enter your score :46
Enter Name And Roll No : Dylan
78
Enter your marks In CP 1 And Cp 2 :23
24
Enter your score :25
Enter Name And Roll No : Ansha
39
Enter your marks In CP 1 And Cp 2 :45
45
Enter your score :45
______________________________________________
Name Rollno CP 1 CP 2 Score Total
----------------------------------------------
Lionel 1 45 23 45 113
Cyril 65 49 42 45 136
Mayank 40 41 43 46 130
Dylan 78 23 24 25 72
Ansha 39 45 45 45 135
----------------------------------------------
*/
Sunday, June 1, 2008
Subscribe to:
Post Comments (Atom)
13 comments:
It was useful
dude ur prog dsnt work..lots of runtime errors..
Infatuation casinos? exclusive this advanced [url=http://www.realcazinoz.com]casino[/url] circumvent and wing it crop online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also foil our brand-new [url=http://freecasinogames2010.webs.com]casino[/url] without at http://freecasinogames2010.webs.com and sketch present on the qui vive dough !
another adscititious [url=http://www.ttittancasino.com]casino spiele[/url] position is www.ttittancasino.com , as an variant of german gamblers, lug forth manumitted online casino bonus.
hey
great forum lots of lovely people just what i need
hopefully this is just what im looking for looks like i have a lot to read.
it is useful program. thanks.........
it is useful program. thanks.........
your program was very useful to know about the concept,thanks...........friend
this is aita from bca 2nd yr.i proude becoz this inheritance things is very inresting but i something understand.
Great post. I think one of the basic things that we should know know is that we must always make sure that you are safe in every transactions you wanted to indulge with.
It was usefull for me.. I used it to save in my phone and cheat in xam :D :D
anyhow thanx . ;)
it sucks....!!!!!!
thanks
easily understandable program,
Thank's
Post a Comment