PROGRAM ON DEFINING A CLASS CANDIDATE.
PROGRAM ON
DEFINING A CLASS CANDIDATE.
#include<iostream.h>
#include<conio.h>
Class
CANDIDATE
{
long int admno;
char name[25];
char cat;
float fees;
void AFEES()
{
if(cat==’C’)
{ fees=5000; }
else if(cat==’F’)
{ fees=7500; }
else if(cat==’S’||cat==’T’)
{ fees=2500; }
else
{ cout<<”Invalid category:”; }
}
public:
void INPUT()
{
cout<<”Enter admission
no.:”;
cin>>admno;
cout<<”Enter name:”;
gets(n);
cout<<”Enter category
[G/F/S/T]:”;
cin>>cat;
AFEES();
}
void OUTPUT()
{
cout<<”Fees card”;
cout<<”Name:”<<n;
cout<<”Category:”<<cat;
cout<<”Fees u have to
pay:”<<fees;
}
};
void main()
{
candidate ob;
clrscr();
ob.input();
ob.output();
getch();
}
Comments
Post a Comment