PROGRAM FOR DEFINING A CLASS ADMISSION USING CONSTRUCTOR.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class
ADMISSION
{
int admno;
char name[20];
int cls;
float fees;
public:
ADMISSION()
{
admno=10;
strcpy(name,’NULL’);
cls=0;
fees=0;
}
Void GETDATA()
{
do
{
cout<<”Enter
admno no. btwn 10-1500”;
cin>>admno;
if(admno<10||admno>1500)
cout<<”Invalid admission no.”;
}
while(admno>10||admno<1500);
cout<<”Enter name:”;
gets(name);
cout<<”Enter class and
fees:”;
cin>>cls>>fees;
}
void PUTDATA()
{
cout<<”Admno:”<<admno;
cout<<”Name:”<<name;
cout<<”Class:”<<cls;
cout<<”Fees:”<<fees;
}
void DRAW_NOS()
{
int num;
randomize();
num=random(1491)+10;
if(num==admno)
PUTDATA();
}
};
Comments
Post a Comment