Вы находитесь на странице: 1из 27

HOSTEL MANAGEMENT

SYSTEM

PROJECT REPORT SUBMITTED IN THE PARTIAL


FULFILLMENT OF STUDIES IN CLASS XII UNDER THE
CBSE SCHEME IN COMPUTER SCIENCE.

SUBMITTED BY:

 JESWIN THOMAS
 G SABARINATH
 BOBY BIJU
 AMITH KESAV M

YEAR: 2019-2020
GOOD SHEPERD PUBLIC SCHOOL THENGANA, CHANGANASSERY
CONTENTS

1. INTRODUCTION
2. PROJECT SPECIFICATION
3. SYSTEM SPECIFICATION
4. DATA DICTIONARY
5. MENU CHOICES AND ACTIONS
6. PROCESS DESIGN
7. SOURCE CODE
8. SAMPLE OUTPUT
9. BIBLIOGRAPHY
INTRODUCTION

This project is designed to carry out activities in a


school hostel. This includes creating displaying,
deleting, modifying and searching records. This
project is written using the concept of object
oriented programming and files of C++.
PROJECT SPECIFICATION

Application area : School Hostel


End user : Warden

MAIN OUTPUT REQUIRED


SYSTEM SPECIFICATION

Processor : Intel ® core™ i3-6098p CPU @ 3.6 GHz


RAM : 4.00 GB (3.80 USABLE)
VDU : VGA
Software : c++ software [Turbo c++]
OS : windows 10 pro
Type : Response to queries
Medium : VDU
Frequency : As and when required.
Data dictionary

Class name : Hostel

Member Functions :
Main_menu( ), add( ), display( ), rooms( ),
edit( ), check( ), modify( ), delete_rec( );

Files used : record.dat,temp.dat


Menu choices anD actions

1. allot a room
2. student record
3. rooms allotted
4. edit record
5. modify record
6. delete record
7. exit
PROCESS DESIGN

On executing the program, a key is to be pressed to continue.


The main menu is displayed as follows:
1. Allot a Room
2. Student Record
3. Rooms Allotted
4. Edit Record
5. Exit
1. Allot A Room
On selecting this option will ask the user for the following
details:
 Room No
 Name
 Address
 Phone No.
The user has the provision to choose their room no. If the
entered room no. is already booked then a message will be
displayed mentioning that the room is already booked.
After entering these details the room will be allotted. These
details are stored into binary file “Recor.dat”.
2. Student Record
The details stored in “Recor.dat” are displayed for the
specified Room No. If the room specified room no is vacant
then it displays the message: sorry room not found or
vacant.
3. Rooms Allotted
The details of all occupied rooms are displayed from
“Recor.dat”.
4. Edit Record
This option has two submenus:-
 Modify Customer Record.
On selecting this, the room no of the student whose
details is to be modified will be asked and it searches
the files from “Recor.dat”.
Now we can add new details and will be stored in
“Recor.dat”.
 Delete Customer Record.
On selecting this option, the room no of the student
whose details are to be deleted is asked. On inputting
the room no, the document will be deleted from
“Recor.dat”.
5. Exit
On selecting this option the output window closes.
SOURCE CODE
#include<iostream.h>
#include<conio.h>
#include<process.h>
//using namespacestd
#include<fstream.h>
#include<stdio.h>

class hostel

{
int room_no;

char name[30];

char address[50];

char phone[10];

public:

int main_menu();

int add();

int display();

int rooms();
int edit();

int check(int);

int modify(int);

int delete_rec(int);

};

int hostel::main_menu()

{
int choice=0;

while(choice!=5)

cout<<"\n\t\t\t\t*************";

cout<<"\n\t\t\t\t* MAIN MENU *";

cout<<"\n\t\t\t\t*************";

cout<<"\n\n\n\t\t\t1.Allot A Room";

cout<<"\n\t\t\t2.student Record";

cout<<"\n\t\t\t3.Rooms Allotted";

cout<<"\n\t\t\t4.Edit Record";

cout<<"\n\t\t\t5.Exit";

cout<<"\n\n\t\t\tEnter Your Choice: ";

cin>>choice;
switch(choice)

{
case 1: add();

break;

case 2: display();

break;

case 3: rooms();

break;

case 4: edit();

break;

case 5: break;

default:

cout<<"\n\n\t\t\tWrong choice!!!";

cout<<"\n\t\t\tPress any key to continue!!";

return 0;

//system("pause");

}
return(0);
}
int hostel::add()

{
int r,flag;

ofstream fout("Recor.dat",ios::binary|ios::out);

cout<<"\n Enter Customer Detalis";

cout<<"\n **********************";

cout<<"\n\n Room no: ";

cin>>r;

flag=check(r);

if(flag)

cout<<"\n Sorry..!!!Room is already booked";

else

room_no=r;

cout<<"\n Name:\t ";

cin>>name;

cout<<"\n Address:\t ";

cin>>address;

cout<<"\n Phone No:\t ";

cin>>phone;
cout<<endl;

fout.write((char*)this,sizeof(*this));

cout<<"\n Room is booked!!!";

cout<<"\n Press any key to continue!!";

system("pause");

fout.close();

return 0;

int hostel::display()

{
ifstream fin("Recor.dat",ios::binary|ios::in);

int r;

cout<<"\n Enter room no: ";

cin>>r;

while(!fin.eof())

fin.read((char*)this,sizeof(*this));

if(room_no == r)

cout<<"\n Cusromer Details";


cout<<"\n ****************";

cout<<"\n\n Room no: "<<room_no;

cout<<"\n Name: "<<name;

cout<<"\n Address: "<<address;

cout<<"\n Phone no: "<<phone;

else

cout<<"\n Sorry Room no. not found or vacant!!";

cout<<"\n\n Press any key to continue!!";

system("pause");

fin.close();

}
return 0;

}
int hostel::rooms()

ifstream fin("Recor.dat",ios::in|ios::binary);

cout<<"\n\t\t\tList Of Rooms Allotted";

cout<<"\n\t\t\t*********************";

cout<<"\n\n Room No.\tName\t\tAddress\t\tPhone


No.\n";

while(fin.read((char*)this,sizeof(*this)))

cout<<"\n\n "<<room_no<<"\t\t"<<name;

cout<<"\t\t"<<address<<"\t\t"<<phone;

cout<<"\n\n\n\t\t\tPress any key to continue!!";

system("pause");

fin.close();

return 0;

}
int hostel::edit()

int choice,r;

cout<<"\n EDIT MENU";

cout<<"\n *********";

cout<<"\n\n 1.Modify Customer Record";

cout<<"\n 2.Delete Customer Record";

cout<<"\n Enter your choice: ";

cin>>choice;

cout<<"\n Enter room no: ";

cin>>r;

switch(choice)

case 1: modify(r);

break;

case 2: delete_rec(r);

break;

default: cout<<"\n Wrong Choice!!";

}
cout<<"\n Press any key to continue!!!";

return 0;

// system("pause");

int hostel::check(int r)

{
int flag=0;

ifstream fin("Recor.dat",ios::in|ios::binary);

while(!fin.eof())

fin.read((char*)this,sizeof(*this));

if(room_no==r)

flag=1;

break;

fin.close();

return(flag);
}

int hostel::modify(int r)

long pos , flag;

fstream
file("Record.dat",ios::in|ios::out|ios::binary);

flag=0;

while(!file.eof())

pos=file.tellg();

file.read((char*)this,sizeof(*this));

if(room_no==r)

cout<<"\n Enter New Details";

cout<<"\n *****************";

cout<<"\n Name: ";

cin>>name;

cout<<" Address: ";

cin>>address;

cout<<" Phone no: ";

cin>>phone;
file.seekg(pos);

file.write((char*)this,sizeof(*this));

cout<<"\n Record is modified!!";

flag=1;

break;

}
}

if(flag==0)

cout<<"\n Sorry Room no. not found or vacant!!";

file.close();

return 0;

int hostel::delete_rec(int r)

int flag=0;

char ch;

ifstream fin("Recor.dat",ios::in|ios::binary);

ofstream fout("temp.dat",ios::out|ios::binary);
while(!fin.eof())

fin.read((char*)this,sizeof(*this));

if(room_no==r)

cout<<"\n Name: "<<name;

cout<<"\n Address: "<<address;

cout<<"\n Pone No: "<<phone;

cout<<"\n\n Do you want to delete this


record(y/n): ";

cin>>ch;

if(ch=='n')

fout.write((char*)this,sizeof(*this));

flag=1;

else

fout.write((char*)this,sizeof(*this));

}
fin.close();

fout.close();

if(flag==0)

cout<<"\n Sorry room no. not found or vacant!!";

else

remove("Recor.dat");

rename("temp.dat","Recor.dat");

// return 0;

}
return 0;
}

int main()

{
clrscr();
hostel h;

cout<<"\n\t\t\t****************************";

cout<<"\n\t\t\t* HOSTEL MANAGEMENT PROJECT *";

cout<<"\n\t\t\t****************************";
cout<<"\n\n\n\n\n\t\t\t\tPress any key to
continue!!";

system("pause");

h.main_menu();

system("pause");

return 0;
}
SAMPLE OUTPUT
BIBLIOGRAPHY

SUMITA ARORA:

COMPUTER SCIENCE WITH C++FOR CLASS XII



Вам также может понравиться