Program of a class Candidate

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

class candidate
{ private:
 long int adm_no;
 char name[20];
 char cat;
 float fees;
 float afees(char);

 public:
 void input();
 void output();
 };
 float candidate::afees(char cat)
 { float F;
 if(cat=='g')
  F=5000;
else if(cat=='f')
F=7500;
else if(cat=='s'||cat=='t')
F=2500;
return(F);
}
void candidate::input()
{
cout<<"enter the admission no";
cin>>adm_no;
cout<<"enter the name";
gets(name);
cout<<"enter the category";
cin>>cat;
fees=afees(cat);
}
void candidate::output()
{cout<<adm_no;
puts(name);
cout<<cat;
cout<<fees;
}
void main()
{ candidate c1;
c1.input();
c1.output();
getch();
}

Comments

Popular Posts