Your Ad Here

Sunday, June 1, 2008

Hybrid inheritance

/******** 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
----------------------------------------------
*/

14 comments:

Anonymous said...

It was useful

Anonymous said...

dude ur prog dsnt work..lots of runtime errors..

Anonymous said...

Confirmation Our Risqu‚ Prices at www.Pharmashack.com, The Unrivalled [b][url=http://www.pharmashack.com]Online To some space [/url][/b] To [url=http://www.pharmashack.com]Buy Viagra[/url] Online ! You Can also Regard Opulent Deals When You [url=http://www.pharmashack.com/en/item/cialis.html]Buy Cialis[/url] and When You You [url=http://www.pharmashack.com/en/item/levitra.html]Buy Levitra[/url] Online. We Also Select a Awe-inspiring Generic [url=http://www.pharmashack.com/en/item/phentermine.html]Phentermine[/url] In support of Your Victuals ! We Hawk Pre-eminence marque [url=http://www.pharmashack.com/en/item/viagra.html]Viagra[/url] and Also [url=http://www.pharmashack.com/en/item/generic_viagra.html]Generic Viagra[/url] !

Anonymous said...

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.

Anonymous said...

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.

Anonymous said...

it is useful program. thanks.........

Anonymous said...

it is useful program. thanks.........

dhanapal said...

your program was very useful to know about the concept,thanks...........friend

Anonymous said...

this is aita from bca 2nd yr.i proude becoz this inheritance things is very inresting but i something understand.

viagra pills said...

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.

Mekey Salaria said...

It was usefull for me.. I used it to save in my phone and cheat in xam :D :D

anyhow thanx . ;)

Anonymous said...

it sucks....!!!!!!

Anonymous said...

thanks

pehu said...

easily understandable program,
Thank's

Your Ad Here