PROGRAM ON DEFINING A CLASS APPLICANT USING CONSTRUCTOR.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class
APPLICANT
{
long ano;
char name[20];
float agg;
char grade;
void GRADEME()
public:
void ENTER();
void RESULT();
};
void
APPLICANT::GRADEME()
{
if(agg>80)
grade=’A’;
else if((agg>=65))
grade=’B’;
else if((agg>=50))
grade=’C’;
else if((agg<50))
grade=’D’;
}
Void
APPLICANT::Enter()
{
cin>>ano;
gets(name);
cin>>agg;
GRADEME();
}
void
APPLICANT::RESULT()
{
cout<<”Applicant result:”;
cout<<”Applicant no.”<<ano;
cout<<”Name is:”<<name;
cout<<”Grade is:”<<grade;
}
Comments
Post a Comment