Earn without any Investment!

Saturday, November 13, 2010

Student details using multiple inheritance

#include<iostream.h>
#include<conio.h>
class basic_info
{
  public:
   int roll;
   char name[20],gender;
};
class academic_fit
{
 public:
   char course[10],semester[2],rank[2];
};
class financial_assist:public basic_info, public academic_fit
{
public:
 float amt;
void getdata()
{
cout<<"Enter Student Details:";
cout<<"\n\tRoll No :";
cin>>roll;
cout<<"\tName :";
cin>>name;
cout<<"\tGender(M or F) :";
cin>>gender;
cout<<"\t  Course :";
cin>>course;
cout<<"\t Semester :";
cin>>semester;
cout<<"\t Rank : ";
cin>>rank;
cout<<"\t Amt Paid :";
cin>>amt;
}
void disp()
{
clrscr();
cout<<"\n\t\tStudent Details";
cout<<"\n\t\t*-*-*-*-*-*-*-*";
cout<<"\n\n\t    Name : "<<name;
cout<<"\n\t  RollNo.: "<<roll;
cout<<"\n\t  Gender : "<<gender;
cout<<"\n\t  Course : "<<course;
cout<<"\n\t Semester: "<<semester;
cout<<"\n\t   Rank  : "<<rank;
cout<<"\n\t Amt.Paid: "<<amt;
}
};
void main()
{
financial_assist s;
clrscr();
s.getdata();
s.disp();
getch();
}

No comments:

Post a Comment