Google PlusFacebookTwitter

Classes – Admission Process

By on Apr 14, 2007 in On A Whim | 0 comments

Share On GoogleShare On FacebookShare On Twitter

/* Copyright (C) 2007 Ankur Banerjee. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */

/* WAP to administer admission process. Define a class ‘admission’ with private members admno (int), name (string), classes (char), fee (float); public members functions readdata() to input data, disp() to display data, drawnos() to choose two students randomly. WARNING: The following program might take a long time to reach completion at the draw numbers stage – it is not an infinite loop problem but until two students are chosen the loop will keep on running, resulting in long program execution time. */

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

int i, flag = 1;

class admission
int admno;
char name[50], classes; // variable name class cannot be used since it is a keyword
float fee;
void readdata()
cout<<endl<<“Enter data for student “<<i + 1
<<endl<<“Enter admission number : “;
cout<<“Enter name of student : “;
cout<<“Enter section of student : “;
cout<<“Enter fees submitted by student : “;
void disp()
cout<<“Displaying data for student”<<endl
<<“Admission number : “<<admno<<endl
<<“Student name : “<<name<<endl
<<“Section : “<<classes;
void drawnum()
int n1;
n1 = random(1991) + 10;
if (( n1 == admno) && (flag < 3))
} s[5];

void main()
cout<<endl<<“Admission Process Management Program”<<endl
<<“Enter initial data for all students”<<endl;
for (i = 0; i < 5; i++)
cout<<endl<<“Randomly choosing students for admission”<<endl;
for (i = 0; i < 5; i++)
} while (flag < 3);
cout<<endl<<“Two students have been chosen randomly out of database”<<

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.