DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 11--------------------------------------------------
MULTIPLE INHERITANCE
DIR By: gaurav
Date: May 1, 2019, 1:09 pm
---------------------------------------------------------
#include<iostream.h>
#include<conio.h>
class parent
{
public: char name[100], course[100];
};
class parent1
{
public: int registerno;
};
class child: public parent, parent1
{
public: float percentage;
child()
{
cout<<"\t\tTO FIND WEATHER A STUDENT IS DETAINED OR NOT\n\n";
cout<<"Enter the name=";
cin>>name;
cout<<"Enter the course=";
cin>>course;
cout<<"Enter the present days=";
cin>>ptdays; //ptdays means present days
cout<<"Enter the absent days=";
cin>>abdays; //abdays means absent days
cout<<"Enter total number of days=";
cin>>tdays; //tdays means total days
percentage=(ptdays*100)/tdays;
}
void output()
{
cout<<"\t\tDETAILS OF STUDENT\n";
cout<<"NAME="<<name<<"\n";
cout<<"COURSE="<<course<<"\n";
cout<<"PRESENT DAYS="<<ptdays<<"\n";
cout<<"ABSENT DAYS="<<abdays<<"\n";
cout<<"TOTAL NUMBER OF DAYS="<<tdays<<"\n";
cout<<"PERCENTAGE OF STUDENT="<<percentage<<"%\n";
if(percentage>75)
{
cout<<"NOT DETAINED!";
}
else
{
cout<<"DETAINED!";
}
}
};
void main ()
{
clrscr();
child ch;
ch.output();
getch();
}
*****************************************************
Page 1 of 1