17.b)Design two base classes Student (S_id, Name, Class ) and Com petition (C_ id , C_Na me ). Derive a class Stud_Comp(Rank) from it. Write a menu driven program to perform following functions:
i.Accept information.
ii.Display information.
iii.Display Student Details in the ascending order of Rank of a specified competition.
#include<conio.h>
class
student
{
public:
char
name[20],class1[20];
int
sid;
public:
void
get()
{
cout<<"Enter
the Student Details:-";
cin>>sid>>name>>class1;
}
void
put()
{
cout<<"\n\n
sid:- "<<sid;
cout<<"\n\n
name:-"<<name;
cout<<"\n\n
class1:-"<<class1;
class
comp
{
public:
int
cid;
public:
void
accept()
{
cout<<"\n\n
Enter the Competition Details:-";
cin>>cid>>cname;
}
void
show()
{
cout<<"\n\n
cid:-"<<cid;
cout<<"\n\n
cname:-"<<cname;
}
};
class
studcomp:student,comp
{
public:
int
rank;
void
acc1()
{
cout<<"\n
Enter rank:-";
cin>>rank;
get();
accept();
}
void
put1()
{
cout<<"\n\n\n
Rank:–"<<rank;
put();
show();
}
void sort(studcomp &r1,studcomp &r2)
};
clrscr();