You are on page 1of 26

Airways

COMPUTER SCIENCE
PROJECT

Developed By

_________________________________

_____________________

Project: AIRWAYS Developed By: _________________________________

1Page
Index
S.no. Description Page No.
1 Certificate 3
2 Acknowledgement & References 4-5
3 Introduction 6-7
4 Source Code 8-17
5 Output Screen 18-25
6 Hardware & Software requirement 26

Project: AIRWAYS Developed By: _________________________________

2Page
Certificate

This is to certify that AIRWAYS Computer Science


project is developed by ___________________
under my supervision in the computer lab of
_____________ in the session 20 -20 . The work
done by him is original.

__________________
HOD, Computer Science
Date: ____________

Project: AIRWAYS Developed By: _________________________________

3Page
Acknowledgement
I would like to express my sincere gratitude to my
computer teacher _____________ for her vital
support, guidance and encouragement without which this
project would not come forth from my side. Who helped
me completing the project by giving ideas, thoughts and
made this project easy and accurate.

I wish to thank my parents for their undivided support and


interest who inspired me and encouraged me to go my own
way, without which I would be unable to complete my
project.

Project: AIRWAYS Developed By: _________________________________

4Page
Reference
1. www.tutorialspoint.com
2. www.cplusplus.com

Project: AIRWAYS Developed By: _________________________________

5Page
INTRODUCTION

We have made project on “AIRWAYS”. We used a class,


structure, functions and arrays in it.
CLASS NAME: file
It has options to do the following tasks:
1. Create Data File
2. Display Records From Data File
3. Display Particular Record From Data File
4. Modify Particular Record From Data File
6. Delete Particular Record From Data File
7. Exit from the Program
It has one data files for storing information. The one data
files are as follows:
• Binary.dat
• New.dat

Project: AIRWAYS Developed By: _________________________________

6Page
Binary.dat – It stores the basic details of the customer
which includes the following:
• Contact No
• Age
• Name
• Destination
• Name Of Airlines

New.dat – It stores the information of the customers. The


following information is stored in the Binary.dat and will
be used to display when you want to display the detailed
information for a particular customer.

Project: AIRWAYS Developed By: _________________________________

7Page
SOURCE
CODE

Project: AIRWAYS Developed By: _________________________________

8Page
#include<fstream.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<process.h>
#include<dos.h>

class file
{

char cno[11];
int age;
char name[30];
char dest[20];
char airway[20];
public:
void input();
void show();
char *getn()
{
return name;
}
};file fileobj;

void file::input()
{
cout<<"Enter your mobile number: ";
cin>>cno;
cout<<"Enter your age: ";
cin>>age;
cout<<"Enter your name: ";
gets(name);
cout<<"Enter your destination: ";
gets(dest);
cout<<"Enter the Airways: ";
gets(airway);
}
void file::show()
{
cout<<"Contact Number==> "<<cno<<endl;
cout<<"Age ==> "<<age<<endl;
cout<<"Name==> "<<name<<endl;
cout<<"Destination==> "<<dest<<endl;

Project: AIRWAYS Developed By: _________________________________

9Page
cout<<"Airways==> "<<airway<<endl;
}
void Create();
void Add();
void Display(); //display all
void DisplayP(); //display a particular record
void Modify();
void Delete();

fstream fil;
void box()
{
gotoxy(14,2);
cout<<"ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»";
gotoxy(14,3);
cout<<"º";
gotoxy(56,3);
cout<<"º";
gotoxy(14,4);
cout<<"º";
gotoxy(56,4);
cout<<"º";

gotoxy(14,5);
cout<<"º";
gotoxy(56,5);
cout<<"º";
gotoxy(14,6);
cout<<"º";
gotoxy(56,6);
cout<<"º";
gotoxy(14,7);
cout<<"º";
gotoxy(56,7);
cout<<"º";
gotoxy(14,8);
cout<<"º";
gotoxy(56,8);
cout<<"º";
gotoxy(14,9);
cout<<"º";
gotoxy(56,9);
cout<<"º";
gotoxy(14,10);

Project: AIRWAYS Developed By: _________________________________

10 P a g e
cout<<"º";
gotoxy(56,10);
cout<<"º";
gotoxy(14,11);
cout<<"º";
gotoxy(56,11);
cout<<"º";
gotoxy(14,12);
cout<<"º";
gotoxy(56,12);
cout<<"º";
gotoxy(14,13);
cout<<"º";
gotoxy(56,13);
cout<<"º";
gotoxy(14,14);
cout<<"º";
gotoxy(56,14);
cout<<"º";
gotoxy(14,15);
cout<<"ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ";

}
void startup()
{
box();
gotoxy(17,4);
cout<<" AIRPLANE DATABASE SYSTEM";
gotoxy(19,6);
cout<<"MADE BY: ";
gotoxy(19,8);
cout<<"_________________________________ ";
gotoxy(19,10);
cout<<"CLASS: XII Science";
}

void menu()
{
int opt;
while(1)
{
clrscr();
cout<<"MAIN MENU"<<endl;
cout<<"============================"<<endl;

Project: AIRWAYS Developed By: _________________________________

11 P a g e
cout<<"1.Create Data File"<<endl;
cout<<"2.Display Record From Data File"<<endl;
cout<<"3.Display Particular Record From Data File"<<endl;
cout<<"4.Modify Paricular Record From Data File"<<endl;
cout<<"5.Delete Particular Record From Data File"<<endl;
cout<<"6.Exit From the Program"<<endl;
cout<<"Enter your Option : "<<endl;
cin>>opt;
switch(opt)
{
case 1:

clrscr();
Create();
cout<<"Display Main Menu"<<endl;
getch();
break;

case 2:

clrscr();
Display();
cout<<"Display Main Menu"<<endl;
getch();
break;

case 3:

clrscr();
DisplayP();
cout<<"Display Main Menu"<<endl;
getch();
break;

case 4:

clrscr();
Modify();
cout<<"Display Main Menu"<<endl;
getch();
break;

case 5:

Project: AIRWAYS Developed By: _________________________________

12 P a g e
clrscr();
Delete();
cout<<"Display Main Menu"<<endl;
getch();
break;

case 6:

exit(0);

default:

cout<<"Wrong Choice....Press Key For View the Main


Menu";
getch();

}
}
}
void main()
{
clrscr();
startup();
delay(4000);
menu();
getch();
}

void Create() //Function to Create Data File


{
char ch='y';
fil.open("binary.dat",ios::app| ios::binary);
while(ch=='y' || ch =='Y')
{
fileobj.input();
fil.write((char*)&fileobj, sizeof(fileobj));
cout<<endl;
cout<<"Want to Continue.....";
cin>>ch;
cout<<"======================="<<endl;

Project: AIRWAYS Developed By: _________________________________

13 P a g e
}
fil.close();
}

void Display() //Function to Display All Record from Data File


{
fil.open("binary.dat",ios::in| ios::binary);
if(!fil)
{
cout<<"File not Found";
exit(0);
}
else
{

while(fil.read((char*)&fileobj, sizeof(fileobj)))
{
fileobj.show();
cout<<"Press Any Key....For Next Record"<<endl;
cout<<"========================"<<endl;
getch();
}
}
fil.close();
}

void DisplayP() //Function to Display particular Record from Data File


{
char n[100];
cout<<"Enter Name that should be searched:";
gets(n);
cout<<endl;
cout<<"====================================="<<endl;
fil.open("binary.dat",ios::in| ios::binary);
if(!fil)
{
cout<<"File not Found";
exit(0);
}
else
{
fil.read((char*)&fileobj, sizeof(fileobj));

Project: AIRWAYS Developed By: _________________________________

14 P a g e
while(!fil.eof())
{
if(strcmp(n,fileobj.getn())==0)
{
fileobj.show();
cout<<"Press Any Key...."<<endl;
getch();
}
else
{
cout<<"Press Any Key....For Search"<<endl;
getch();
}
fil.read((char*)&fileobj, sizeof(fileobj));
}
}
fil.close();
}
void Modify() //Function to Modify Particular Record from Data File
{
char n[30];
cout<<"Enter Name that should be searched:";
gets(n);
cout<<endl;
cout<<"============================"<<endl;
fil.open("binary.dat",ios::in| ios::out|ios::binary);
if(!fil)
{
cout<<"File not Found";
exit(0);
}
else
{
fil.read((char*)&fileobj, sizeof(fileobj));
while(!fil.eof())
{
if(strcmp(n,fileobj.getn())==0)
{
fil.seekg(0,ios::cur);
cout<<"Enter New Record.."<<endl;
fileobj.input();
fil.seekp(fil.tellg() - sizeof(fileobj));
fil.write((char*)&fileobj, sizeof(fileobj));
}

Project: AIRWAYS Developed By: _________________________________

15 P a g e
else
{
cout<<"Press Any Key....For Search"<<endl;
getch();
}
fil.read((char*)&fileobj, sizeof(fileobj));
}
}
fil.close();
}

void Delete() //Function to Delete Particular Record from Data File


{
char n[100];
cout<<"Enter Name that should be Deleted :";
gets(n);
int flag=0;
ofstream o;
o.open("new.dat",ios::app|ios::binary);
fil.open("binary.dat",ios::in| ios::binary);
if(!fil)
{
cout<<"File not Found";
exit(0);
}
else
{

while(fil.read((char*)&fileobj, sizeof(fileobj)))
{
if(strcmp(n,fileobj.getn())!=0)
{
o.write((char*)&fileobj, sizeof(fileobj));
}
else
{
flag=1;
}
fil.read((char*)&fileobj, sizeof(fileobj));
}
}
o.close();
fil.close();
if(flag==1)

Project: AIRWAYS Developed By: _________________________________

16 P a g e
{
cout<<"This Record has been Deleted"<<endl;
getch();
}
else
{
cout<<"No such Record Exists"<<endl;
}
remove("binary.dat");
rename("new.dat", "binary.dat");
}

Project: AIRWAYS Developed By: _________________________________

17 P a g e
Output

Project: AIRWAYS Developed By: _________________________________

18 P a g e
Project: AIRWAYS Developed By: _________________________________

19 P a g e
Main menu

Project: AIRWAYS Developed By: _________________________________

20 P a g e
Option 1: create data file

Project: AIRWAYS Developed By: _________________________________

21 P a g e
Option 2: Display all records
from data file

Project: AIRWAYS Developed By: _________________________________

22 P a g e
OPTION 3: DISPLAY PARTICULAR RECORD
FROM DATA FILE

Project: AIRWAYS Developed By: _________________________________

23 P a g e
OPTION 4: MODIFY PARTICULAR RECORD
FROM DATA FILE

Project: AIRWAYS Developed By: _________________________________

24 P a g e
OPTION 5: DELETE PARTICULAR RECORD
FROM DATA FILE

1. RIGHT NAME ENTERED:

2. WRONG NAME ENTERED:

Project: AIRWAYS Developed By: _________________________________

25 P a g e
Hardware & Software
Requirement

Hardware Requirement:

Intel core/i3/i5/i7 or any equivalent


With at least 256 MB RAM
2 MB free space on Hard Disk
Color Monitor/LCD

Operating System & Compiler


MS Windows
Turbo C++ 3.0 Compiler/Dev C++ or any equivalent

Project: AIRWAYS Developed By: _________________________________

26 P a g e

You might also like