Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Pictures MCA Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



C++ Program for Multiple Inheritance


Posted Date: 14 Jun 2008    Resource Type: Articles/Knowledge Sharing    Category: Computer & Technology

Posted By: Girish Patil       Member Level: Diamond
Rating:     Points: 2



/* ASSIGNMENT NO.5 */
/* MULTILEVEL INHERITANCE */
/* STORE STUDENTS DATA */


#include
#include
#include
#include

class student
{
protected:
char name[31];
int rollno;
public:
void input() //get name & roll no. of student
{
cout<<"\n\n Enter name:";
cin>>name;
cout<<"\n Enter roll no:";
cin>>rollno;
}
void show() //show name & roll no
{
cout<<"\n\n Name: "< }
}; //end of class student

class average:public student
{
protected:
int s1;
int s2;
int s3;
int s4;
int s5;
float average;
public:
void avg() //get marks in 5 subjects
{
cout<<"\n\n Enter the marks in 5 subjects(out of 100): ";
cin>>s1>>s2>>s3>>s4>>s5;
average=float(s1+s2+s3+s4+s5)/5;
cout<<"\n\n Average is:"< }
}; //end of class average

class percent:public average
{
protected:
float percentage;
public:
void perct()
{
float total=s1+s2+s3+s4+s5;
percentage=float((total*100)/500);
cout<<"\n\n The percentage is:"< if(percentage>=65)
{
cout<<"\nGrade is: FIRST CLASS";
}
else if(percentage>=50 && percentage<65)
{
cout<<"\nGrade is: SECOND CLASS";
}
else if(percentage>=40 && percentage<50)
{
cout<<"\nGrade is: THIRD CLASS";
}
else
{
cout<<"\n STUDENT IS FAIL";
}
}
}; //end of class percent

void main()
{
clrscr();
int no;
cout<<"\n Enter no. of students: ";
cin>>no;
for(int i=0;i {
percent s2;
s2.input();
s2.show();
s2.avg();
s2.perct();
}
getch();
} //end of main




Responses

Author: Tejwant Singh Randhawa    15 Jun 2008Member Level: Silver   Points : 2
Nice Code my friend for c++ inheritance but you should double check your heading before posting the article. This program is for Multilevel Inheritance not for Multiple Inheritance.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C++ Program for Simplae Inheritance
Previous Resource: C++ Program for Multilevel Inheritance
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Editors    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.