Академический Документы
Профессиональный Документы
Культура Документы
SYSTEM
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
Member Functions :
Main_menu( ), add( ), display( ), rooms( ),
edit( ), check( ), modify( ), delete_rec( );
1. allot a room
2. student record
3. rooms allotted
4. edit record
5. modify record
6. delete record
7. exit
PROCESS DESIGN
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*************";
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";
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!!!";
return 0;
//system("pause");
}
return(0);
}
int hostel::add()
{
int r,flag;
ofstream fout("Recor.dat",ios::binary|ios::out);
cout<<"\n **********************";
cin>>r;
flag=check(r);
if(flag)
else
room_no=r;
cin>>name;
cin>>address;
cin>>phone;
cout<<endl;
fout.write((char*)this,sizeof(*this));
system("pause");
fout.close();
return 0;
int hostel::display()
{
ifstream fin("Recor.dat",ios::binary|ios::in);
int r;
cin>>r;
while(!fin.eof())
fin.read((char*)this,sizeof(*this));
if(room_no == r)
else
system("pause");
fin.close();
}
return 0;
}
int hostel::rooms()
ifstream fin("Recor.dat",ios::in|ios::binary);
cout<<"\n\t\t\t*********************";
while(fin.read((char*)this,sizeof(*this)))
cout<<"\n\n "<<room_no<<"\t\t"<<name;
cout<<"\t\t"<<address<<"\t\t"<<phone;
system("pause");
fin.close();
return 0;
}
int hostel::edit()
int choice,r;
cout<<"\n *********";
cin>>choice;
cin>>r;
switch(choice)
case 1: modify(r);
break;
case 2: delete_rec(r);
break;
}
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)
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 *****************";
cin>>name;
cin>>address;
cin>>phone;
file.seekg(pos);
file.write((char*)this,sizeof(*this));
flag=1;
break;
}
}
if(flag==0)
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)
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)
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****************************";
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: