尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Kendriya Vidyalaya No.1
Panambur, Mangalore
Bus Transportation query
Code in C++
Computer Science Project
2017-2018
BY~
Transportation query Page 2
Sudhanshu B Moolya
Umesh B Kumar
Varshith M K
Index
1. Certificate
……………………...............3
2. Acknowledgement……………….
........4
3. Introduction
………………………..……..5
Transportation query Page 3
4. Exiting
system.……………………..…….6
5. Objectives………….………………..
………7
6. Function
Specification…………........8
7. System
requirement…………..…......9
8. Existing
System………………………….10
Transportation query Page 4
9. Data flow
diagram…………………….…11
10. Header Files& Files
Created.13
11. Sources
code……………………..…......14
12. Output
report………………........59
13. Sources and
Bibliography…..71
Transportation query Page 5
CERTIFICATE
This is to certify that of Kendriya Vidyalaya
No.1, Panambur has successfully completed the Computer
science Annual Project on Bus Transportation Query C++ as
per the rules of Central Board of Secondary Education for the
academic year 2017-2018.
Teacher in charge Principal
[Mr.Sunil Kumar T ] [ ]
External Examiner
Transportation query Page 6
Acknowledgement
I hereby acknowledge my deep sense of gratitude and
indebtedness of the following personalities whose immense
guidance, encouragement, necessary suggestions, initiations,
enthusiasm and inspiration made this work a master art and a
joint enterprise.
Mrs. Alice Joseph - (Principal)
Mr. Sunil Kumar .T (PGT Computer Science)
And my classmates and friends.
Transportation query Page 7
INTRODUCTION
The Bus Ticket Reservation System is a C++ based
application that allows visitors check bus ticket availability,
buy bus ticket and pay the bus ticket . This system is
established for all the home/office users after gaining
access from the administrator. Online Bus Reservation
System provides bus transportation system, a facility to
reserved seats, cancellation of seats and different types of
enquiry which need an instant and quick reservation.
The use of bus traveling is a large growing business in
many countries; hence bus reservation system deals with
maintenance of records of each passenger who had
reserved a seat for a journey. It also includes maintenance
of information like schedule and details of each bus
(Shivaji, 2010). Also, we get to know that there are many
operations, which they have to do manually. It takes a lot
of time and causes many errors. Due to this, sometimes a
lot of problems occur and they were facing many disputes
with customers. To solve the above problem, and further
maintaining records of items, seat availability for
customers, price of per seat, bill generation and other
things, we are offering this proposal of reservation system.
Transportation query Page 8
Existing System
• The work is done manually.
• Those who are interested in inquiring about
the Bus Type, its Tickets Price, available seats,
facility of the bus etc. has to walk to the
Booking office.
• This creates a huge Relief for the Customer of
the Office on weekends to save their time.
Transportation query Page 9
Objectives
The objective of travel query in C++ is
very vast. Mainly it is the Bus
transportation query for which people
use travel query. C++ programming
helps us to know all the details about
the bus reservation. It tells and helps
people by giving details like bus name,
boarding time, arrival time, ticket cost.
Transportation query Page 10
Most importantly it also gives
information about the seating
arrangement and shows seat which is
occupied as 0. It also facilitates ticket
booking and cancellation.
FUNCTIONAL
SPECIFICATION
Transportation query Page 11
User
• This Project basically provides a Bus information
and regarding bus information.
• User who’re not registered should sign up and
user who’re already signed can login for further
process.
• User can search bus based on where he want to
go and where to board into the bus.
• Users can also choose his own seats in bus by
seeing the seating arrangement of the bus.
Admin
• A person can only register as admin into the
system only if he known verification password of
admin
• In this system admin, can maintain all the Bus
information and also maintain Bus details,
addition of new bus details, etc.
• In this system admin, can maintain the, and also
admin can generate a report and managethe
whole system.
Transportation query Page 12
Hardware
Requirement(Minimum)
Minimum Server Requirement:
Minimum Client Requirement:
Processor 2 GHZ
RAM 500 MB
Disk Space 20 GB of Free Space
Software
Requirement(Minimum)
Server Software Requirement:
Operating System Windows server 2003
Front End C++
Back End SQL Server 2005
Client Software Requirement:
Processor 1 GHZ
RAM 2 TB
Disk Space Disk Space
Transportation query Page 13
Operating System Windows Xp or Any
equivalent OS
Existing System
• The work is done manually.
• Those who are interested in inquiring about
the Bus Type, its Tickets Price, available seats,
facility of the bus etc. has to walk to the
Booking office.
• This creates a huge Relief for the Customer of
the Office on weekends to save their time.
Transportation query Page 14
Data Flow
Diagram
Transportation query Page 15
Transportation query Page 16
Header Files and Files
created
Header Files
1.#include <iostream>
2.#include <string.h>
3.#include <fstream>
4.#include <conio.h>
5.#include <stdio.h>
6.#include <stdlib.h>
Files created
private.dat ->a data file which store’s the admin id
and password
private2.dat ->a data file which store’s the user id
and password
database.dat->a data file which store’s the bus
details.
Transportation query Page 17
passengerdetail.dat->a data file which store’s the
details of the passenger.
SOURCE CODE
#include <iostream>
#include <string.h>
#include <fstream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
void vline(char ch);
Transportation query Page 18
int sr=0;
class reg_log
{
char name[30], username[30], password[30], adminpass[30];
int verified;
public:
int identify;
char usern[30], pass[30], a[30];
reg_log()
{
strcpy(adminpass,"project");
}
int verification()
{
Transportation query Page 19
return(verified);
}
char* passwords()
{
return(password);
}
char* idname()
{
return(username);
}
int indentification();
void regis();
}admin,user;
int reg_log::indentification()
Transportation query Page 20
{
char pass[30], a[30];
cout<<"nnEnter the admin password for verification :
";gets(a);
gets(pass);
if(strcmp(pass,adminpass)==0)
{
identify=0;
return (identify);
}
}
void reg_log::regis()
{
int i;
if(identify==0)
Transportation query Page 21
{
cout<<"nnEnter your name : ";
gets(name);
cout<<"nnEnter your user name : ";
gets(username);
cout<<"nnEnter your password : ";
for(i=0; ;++i)
{
password[i]=getch();
cout<<"*";
if(password[i]==13)
{
password[i]='0';
break;
}
Transportation query Page 22
}
cout<<"nn Enter any key to continue........";
getch();
}verified=1;
}
class ticket
{
char name[30], email[40], gender;
int phoneno[10], pnr[2], seatno;
public:
void input(int, int);
void display();
int pnr_num1()
{
Transportation query Page 23
return(pnr[0]);
}
int pnr_num2()
{
return(pnr[1]);
}
}tic;
void ticket::input(int seat, int busnum)
{
int i;
pnr[0]=seat;
pnr[1]=busnum;
seatno=seat;
cout<<"nnEnter your name ";
Transportation query Page 24
gets(name);
cout<<"nEnter your email ";
gets(email);
cout<<"nEnter your gender (enter m->male, f->female)";
cin>>gender;
cout<<"nEnter your phoneno";
for(i=0;i<10;++i)
cin>>phoneno[i];
cout<<"nnNOTE-YOUR PNR NUMBER IS ->"<<pnr[0]<<"
"<<pnr[1];
cout<<endl;
}
void ticket::display()
{
int i;
Transportation query Page 25
cout<<"nn NAME - ";
puts(name);
cout<<"n PNR NUMBER - "<<pnr[0]<<" "<<pnr[1];
cout<<"n EMAIL ADDRESS - ";
puts(email);
cout<<" Gender - "<<gender;
cout<<"n PHONE NUMBER - ";
for(i=0;i<10;++i)
cout<<phoneno[i];
cout<<"n SEAT NUMBER - ";
cout<<seatno;
}
class database
Transportation query Page 26
{
char busname[30], bustype[30], from[30], to[30],
btime[6],dtime[6];
int busno, seat[10][50], row, col;
float price;
public:
void install();
void show();
void print();
int search_it()
{
return(busno);
}
void print_seat();
int showbus();
void searchb();
Transportation query Page 27
}bobj;
void database::install() //this function is for entering bus details
{
int i, j, num=0;
char a[20];
cout<<"nEnter bus no: ";
cin>>busno;
cout<<"nEnter the bus name: ";gets(a);
gets(busname);
Transportation query Page 28
cout<<"nEnter the bus type: ";
gets(bustype);
cout<<"nBoarding time: ";
gets(btime);
cout<<"nDropping time: ";
gets(dtime);
cout<<"nFrom: ttt";
gets(from);
cout<<"nTo: ttt";
gets(to);
Transportation query Page 29
cout<<"nNumber of rows and column of seats";
cin>>row>>col;
for(i=0;i<row;++i)
{
for(j=0;j<col;++j)
{
++num;
seat[i][j]=num; //this is to saw that the seat is
empty
}
}
cout<<"nCost of ticket per adult: ";
cin>>price;
Transportation query Page 30
}
void database::show()
{
cout<<"n"<<busno<<"t "<<busname<<"t
"<<bustype<<"t "<<btime<<"t "<<dtime<<"t
"<<from<<" "<<to<<"n";
}
void database::print()
{
cout<<"nn Bus no:"<<busno
<<"n Bus name:"<<busname
<<"n Bus type:"<<bustype
<<"n Boarding time:"<<btime
Transportation query Page 31
<<"n Dropping time:"<<dtime
<<"n From:"<<from
<<"n To"<<to
<<"n Price per person"<<price;
}
void database::print_seat()
{
int i,j;
for(i=0;i<row;++i)
{
for(j=0;j<col;++j)
{
cout<<seat[i][j]<<" ";
}
Transportation query Page 32
cout<<endl;
}
}
int database::showbus()
{
int busnum;
char tempfrom[15], tempto[15], ch[15];
cout<<"Enter the place name from where you need to catch
the bus :";gets(ch);
gets(tempfrom);
cout<<"Enter the place name where you want to go :";
gets(tempto);
cout<<"nthese are the bus that you can travel inn";
fstream fobj;
fobj.open("database.dat",ios::in|ios::binary);
Transportation query Page 33
while(fobj.read((char*)&bobj,sizeof(database)))
{
if((strcmp(from,tempfrom)==0)&&(strcmp(to,tempto)==0))
{
vline('+');
print();
cout<<"nSeating arrangement in the bus is as shown
belown('0' means the seat is occupied)n";
print_seat();
vline('+');
}
}
cout<<"nnEnter the bus no. whose ticket you want";
cin>>busnum;
fobj.close();
Transportation query Page 34
return(busnum);
}
void database::searchb()
{
int num, no_tic, temp[25], a[10], i , j, total, opt, k=0, flag=0;
char ch[15];
long int p;
num=bobj.showbus();
cout<<"enter the number of ticket's you want";
cin>>no_tic;
fstream fobj, pobj;
fobj.open("database.dat",ios::in|ios::out|ios::binary);
pobj.open("passengerdetail.dat",ios::out|ios::binary);
Transportation query Page 35
while(!fobj.eof())
{
p=fobj.tellp();
fobj.read((char*)&bobj,sizeof(database));
if(num==bobj.search_it())
{
cout<<endl;
print_seat();
while(k<no_tic)
{
cout<<"nEnter the seat number(see the above pic
and enter,'0' means the seat is occupied)";
cin>>temp[k];
for(i=0;i<row;++i)
{
for(j=0;j<col;++j)
Transportation query Page 36
{
if(temp[k]==seat[i][j])
{
if(seat[i][j]!=0)
{
cout<<"nnEnter the passenger's detail";
gets(ch);
tic.input(seat[i][j],num);
seat[i][j]=0;
pobj.write((char*)&tic,sizeof(ticket));
}
else if(seat[i][j]==0)
{
cout<<"nnthis seat is already booked";
--k;
Transportation query Page 37
getch();
}
}
}
}
++k;
print_seat();
}
total=no_tic*price;
cout<<"nntotal price ="<<total;
cout<<"nnEnter 1 to buy the ticket or Enter 2 to go
back to user page";
cin>>opt;
switch(opt)
{
Transportation query Page 38
case 1:
cout<<"nnthank you for buying the ticket & have a
happy journey :) ";
print_seat();
fobj.seekp(p,ios::beg);
fobj.write((char*)&bobj,sizeof(database));
cout<<endl<<"The bus Record Updated
Successfully...n";
break;
case 2:
break;
}
}
}
pobj.close();
fobj.close();
Transportation query Page 39
getch();
}
void vline(char ch)
{
for (int i=80;i>0;i--)
cout<<ch;
}
Transportation query Page 40
void delete_bus(int);
int main()
{
int opt1, opt2, opt3, num1, num2, bno, num[10];
void regi_admin();
void regi_user();
int login_admin();
int login_user();
void new_bus();
void print_bus();
void print1_bus();
void edit_bus();
void search_bus();
Transportation query Page 41
void display_tic(int num[10]);
void print_tic(int num[10]);
void cancel_tic(int num[10]);
do
{
system("CLS");
cout<<"ntttSUV
TRAVELSntt****************************"
<<"nnttt MENU"
<<"nnt 1. Register"
<<"nt 2. Login as admin"
<<"nt 3. Login as user"
<<"nt 4. Exit";
cout<<"nnt Enter your choice : ";
cin>>opt1;
Transportation query Page 42
switch(opt1)
{
case 1:
int opt;
cout<<"nnt 1. To register as admin";
cout<<"nt 2. To register as user";
cout<<"nnt Enter your choice : ";
cin>>opt;
switch(opt)
{
case 1:
regi_admin();
break;
case 2:
regi_user();
Transportation query Page 43
break;
}
break;
case 2:
num1=login_admin();
if(num1==1)
{
do
{
system("CLS");
cout<<"nttt ADMIN MENUn"
<<"nnt1. Add new bus detail"
<<"nt2. Printing all bus details"
<<"nt3. Printing a particular bus detail"
<<"nt4. Editing the bus record"
Transportation query Page 44
<<"nt5. Deleting a bus record"
<<"nt6. Sign out"
<<"nntEnter your choice";
cin>>opt2;
switch(opt2)
{
case 1:
new_bus();
break;
case 2:
print_bus();
break;
case 3:
print1_bus();
break;
Transportation query Page 45
case 4:
edit_bus();
break;
case 5:
{
cout<<"nEnter the bus no. of the bus whose
Record is to be Deleted:";
cin>>bno;
delete_bus(bno);
break;
}
}
}while(opt2!=6);
}
break;
case 3:
Transportation query Page 46
num2=login_user();
if(num2==1)
{
do
{
system("CLS");
cout<<"nttt USER MENUn"
<<"nnt1. Booking a ticket"
<<"nt2. Display ticket"
<<"nt3. Cancel ticket"
<<"nt4. Print ticket"
<<"nt5. Sign out"
<<"nnt Enter your choice : ";
cin>>opt3;
switch(opt3)
Transportation query Page 47
{
case 1:
bobj.searchb();
break;
case 2:
cout<<"nnEnter your pnr number to access
your ticket details";
cin>>num[0]>>num[1];
display_tic(num);
cout<<"nnEnter any key to go back to user
page";
getch();
break;
case 3:
cout<<"nnEnter your pnr number to access
your ticket details for canceling";
Transportation query Page 48
cin>>num[0]>>num[1];
cancel_tic(num);
break;
case 4:
cout<<"nnEnter your pnr number to access
your ticket details";
cin>>num[0]>>num[1];
print_tic(num);
break;
}
}while(opt3!=5);
}
break;
}
}while(opt1!=4);
Transportation query Page 49
return 0;
}
void regi_admin()
{
int identify;
cout<<"nt To register as admin ";
fstream adobj;
adobj.open("private.dat",ios::out|ios::app|ios::binary);
identify=admin.indentification();
if(identify==0)
{
admin.regis();
adobj.write((char*)&admin,sizeof(reg_log));
adobj.close();
Transportation query Page 50
}
}
void regi_user()
{
cout<<"ntTo register as user ";
fstream usobj;
usobj.open("private2.dat",ios::out|ios::app|ios::binary);
user.regis();
usobj.write((char*)&user,sizeof(reg_log));
usobj.close();
}
int login_admin()
{
Transportation query Page 51
int ch=0,i;
cout<<"nttLOGIN PAGEn";
char password[15], a[15];
fstream f;
f.open("private.dat",ios::in|ios::out|ios::binary);
char id[100];
cout<<"nn Enter your id:";gets(a);
gets(id);
cout<<"n Enter your password : ";
for(i=0; ;++i)
{
password[i]=getch();
Transportation query Page 52
cout<<"*";
if(password[i]==13)
{
password[i]='0';
break;
}
}
while(f.read((char *) & admin,sizeof(reg_log)))
{
if((strcmp(admin.idname(),id)==0)&&(strcmp(admin.passwords(),
password)==0))
{
ch=1;
}
}
f.close();
Transportation query Page 53
return(ch);
}
int login_user()
{
int ch=0,i;
cout<<"nttLOGIN PAGEn";
char password[15], a[15];
fstream f;
f.open("private2.dat",ios::in|ios::out|ios::binary);
char id[100];
cout<<"nn Enter your id:";gets(a);
Transportation query Page 54
gets(id);
cout<<"n Enter your password : ";
for(i=0; ;++i)
{
password[i]=getch();
cout<<"*";
if(password[i]==13)
{
password[i]='0';
break;
}
}
while(f.read((char *) & user,sizeof(reg_log)))
{
if((strcmp(user.idname(),id)==0)&&(strcmp(user.passwords(),pass
word)==0))
Transportation query Page 55
{
ch=1;
}
}
f.close();
return(ch);
}
void new_bus()
{
char a;
fstream fobj;
fobj.open("database.dat",ios::out|ios::app|ios::binary);
do
Transportation query Page 56
{
bobj.install();
fobj.write((char*)&bobj,sizeof(database));
cout<<endl<<"nThe details of the bus is Created in
the File...nn";
cout<<endl<<"Do You Want to Add Another
Record(Y/N):";
a=getche();
}while(a=='y'||a=='Y');
fobj.close();
cout<<"n Press any key to continue...";
getch();
}
void edit_bus()
Transportation query Page 57
{
cout<<"n Program for Modifying a bus Recordn";
fstream fobj;
int num;
long int p;
fobj.open("database.dat",ios::in|ios::out|ios::binary);
int flag=0;
cout<<"nInput the busNo.of the bus which you want
to Modify:";
cin>>num;
while(!fobj.eof())
{
p=fobj.tellp();
fobj.read((char*)&bobj,sizeof(database));
if(num==bobj.search_it())
Transportation query Page 58
{
vline('+');
bobj.print();
cout<<"nSeating arrangement in the bus is as
shown belown('0' means the seat is occupied)n";
bobj.print_seat();
vline('+');
bobj.install();
fobj.seekp(p,ios::beg);
fobj.write((char*)&bobj,sizeof(database));
cout<<endl<<"The bus Record
Updated Successfully...n";
flag=1;
break;
}
Transportation query Page 59
}
if(flag==0)
cout<<"n bus record is Not Found...n";
cout<<"n Press any key to continue...";
getche();
fobj.close();
}
void print_bus()
{
fstream fobj;
fobj.open("database.dat",ios::in|ios::binary);
vline('+');
cout<<"nBus no: Bus name Bus type: Arrival time:
Departure time: From: t To:n";
Transportation query Page 60
vline('+');
while(fobj.read((char*)&bobj,sizeof(database)))
{
++sr;
bobj.show();
}
sr=0;
fobj.close();
cout<<"n Press any key to continue...";
getche();
}
void print1_bus()
{
Transportation query Page 61
int bnum;
fstream fobj;
fobj.open("database.dat",ios::in|ios::binary);
int flag=0;
cout<<endl<<"Enter the Bus.No. of the bus which you
want to Search:";
cin>>bnum;
while(fobj.read((char*)&bobj,sizeof(database)))
{
if(bnum==bobj.search_it())
{
cout<<endl<<"Bus Record is Found in
the File...Details are given belown";
vline('+');
bobj.print();
Transportation query Page 62
cout<<"nSeating arrangement in the
bus is as shown belown('0' means the seat is occupied)n";
bobj.print_seat();
cout<<endl;
vline('+');
flag=1;
}
}
if(flag==0)
cout<<"n Sorry...The bus Record with the Bus No.
"<<bnum<<" Not Found in the Filen";
fobj.close();
cout<<"n Press any key to continue...";
getche();
}
Transportation query Page 63
void delete_bus(int bno)
{
fstream fobj,fout;
fobj.open("database.dat",ios::in|ios::binary);
fout.open("temp.dat",ios::out|ios::binary);
char found='f';
int confirm=0;
while(fobj.read((char*)&bobj,sizeof(database)))
{
if(bno==bobj.search_it())
{
bobj.show();
found='t';
cout<<"nConfirmation of Deletion
press 1 to Delete or 0 to Cancel";
cin>>confirm;
Transportation query Page 64
if(confirm==0)
{
fout.write((char*)&bobj,sizeof(database));
}
else
{
cout<<"nnnn The Bus Record
is Deleted...n";
}
}
else
fout.write((char*)&bobj,sizeof(database));
}
if(found=='f')
cout<<endl<<"Student Record Not Found...n";
Transportation query Page 65
fobj.close();
fout.close();
remove("database.dat");
rename("temp.dat","database.dat");
cout<<"n Press any key to continue...";
getche();
}
void display_tic(int num[10])
{
fstream fobj, pobj;
pobj.open("passengerdetail.dat",ios::in|ios::binary);
while(pobj.read((char*)&tic,sizeof(ticket)))
Transportation query Page 66
{
if(num[0]==tic.pnr_num1()&&num[1]==tic.pnr_num2())
{
cout<<endl;
vline('+');
cout<<"nttSUV travels";
tic.display();
num[0]=tic.pnr_num1();
num[1]=tic.pnr_num2();
}
}
getch();
pobj.close();
fobj.open("database.dat",ios::in|ios::binary);
while(fobj.read((char*)&bobj,sizeof(database)))
Transportation query Page 67
{
if(num[1]==bobj.search_it())
{
bobj.print();
cout<<endl;
vline('+');
}
}
fobj.close();
}
void print_tic(int num[10])
Transportation query Page 68
{
fstream fobj, pobj, printer;
fobj.open("database.dat",ios::in|ios::binary);
pobj.open("passengerdetail.dat",ios::in|ios::binary);
printer.open("pnr",ios::out);
while(pobj.read((char*)&tic,sizeof(ticket)))
{
if(num[0]==tic.pnr_num1()&&num[1]==tic.pnr_num2())
{
cout<<endl;
vline('+');
cout<<"nttSUV travels";
tic.display();
printer.write((char*)&tic,sizeof(ticket));
Transportation query Page 69
num[0]=tic.pnr_num1();
num[1]=tic.pnr_num2();
}
}
while(fobj.read((char*)&bobj,sizeof(database)))
{
if(num[1]==bobj.search_it())
{
bobj.print();
printer.write((char*)&bobj,sizeof(database));
vline('+');
}
}
fobj.close();
pobj.close();
Transportation query Page 70
}
void cancel_tic(int pnr[2])
{
fstream fobj,fout;
fobj.open("passengerdetail.dat",ios::in|ios::binary);
fout.open("temp.dat",ios::out|ios::binary);
char found='f';
int confirm=0;
while(fobj.read((char*)&tic,sizeof(ticket)))
{
if(pnr[0]==tic.pnr_num1()&&pnr[1]==tic.pnr_num2())
{
Transportation query Page 71
display_tic(pnr);
found='t';
cout<<"nConfirmation of Deletion
press 1 to Delete or 0 to Cancel";
cin>>confirm;
if(confirm==0)
{
fout.write((char*)&tic,sizeof(ticket));
}
else
{
cout<<"nnnn The passenger
Record is Deleted...n";
}
}
else
Transportation query Page 72
fout.write((char*)&tic,sizeof(ticket));
}
if(found=='f')
cout<<endl<<"passenger Record Not Found...n";
fobj.close();
fout.close();
remove("passengerdetail.dat");
rename("temp.dat","passengerdetail.dat");
cout<<"n Press any key to continue...";
getche();
}
OUTPUT REPORT
Transportation query Page 73
MAIN MENU
Transportation query Page 74
REGISTERATION
Transportation query Page 75
LOGIN PAGE
Transportation query Page 76
ADMIN MENU
Transportation query Page 77
ADD NEW BUS DETAIL
Transportation query Page 78
PRINTING ALL BUS DETAILS
Transportation query Page 79
PRINTING A PARTICULAR BUS
DETAILS
Transportation query Page 80
EDITING THE BUS RECORD
Transportation query Page 81
DELETING BUS RECORD
USER MENU
Transportation query Page 82
FOR BOOKING A TICKET
Transportation query Page 83
DISPLAY YOUR TICKET DETAILS
Transportation query Page 84
CANCELATION OF TICKET
Transportation query Page 85
Sources and Bibliography
The basic idea of the project is evolved after the system study of the bus
query system from the website redbus.com.
For programming concepts and functions
 Computer Science with C++ By SumitaArora
 The C++ Programming Language Book by Bjarne Stroustrup
 Programming: Principles and Practice Using ...Book by Bjarne
Stroustrup

More Related Content

What's hot

Online bus reservation system
Online bus reservation systemOnline bus reservation system
Online bus reservation system
SannanGulzar
 
Online reservation of bus
Online reservation of busOnline reservation of bus
Online reservation of bus
Saifullah Malik
 
Online bus booking system-A Case study on Normalisation
Online bus booking system-A Case study on NormalisationOnline bus booking system-A Case study on Normalisation
Online bus booking system-A Case study on Normalisation
Savita Marwal
 
Bus Booking Management System
Bus Booking Management SystemBus Booking Management System
Bus Booking Management System
Mike Marshall
 
Database Management System of Travel Co.
Database Management System of Travel Co.Database Management System of Travel Co.
Database Management System of Travel Co.
Awais Ali
 
Online travel booikng
Online travel booikngOnline travel booikng
Online travel booikng
sanket shah
 
Online Bus Service
Online Bus ServiceOnline Bus Service
Online Bus Service
saurabh kumar
 
ONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEMONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEM
christ university
 

What's hot (8)

Online bus reservation system
Online bus reservation systemOnline bus reservation system
Online bus reservation system
 
Online reservation of bus
Online reservation of busOnline reservation of bus
Online reservation of bus
 
Online bus booking system-A Case study on Normalisation
Online bus booking system-A Case study on NormalisationOnline bus booking system-A Case study on Normalisation
Online bus booking system-A Case study on Normalisation
 
Bus Booking Management System
Bus Booking Management SystemBus Booking Management System
Bus Booking Management System
 
Database Management System of Travel Co.
Database Management System of Travel Co.Database Management System of Travel Co.
Database Management System of Travel Co.
 
Online travel booikng
Online travel booikngOnline travel booikng
Online travel booikng
 
Online Bus Service
Online Bus ServiceOnline Bus Service
Online Bus Service
 
ONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEMONLINE BUS BOOKING SYSTEM
ONLINE BUS BOOKING SYSTEM
 

Similar to Bus transportation query report

Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
Debashis Rath
 
Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
Debashis Rath
 
Visual c
Visual cVisual c
Visual c
mrshymah
 
cs project.docx investigatory computer science
cs project.docx investigatory computer sciencecs project.docx investigatory computer science
cs project.docx investigatory computer science
rahulrahul45165
 
Hard copy of proj doc
Hard copy of proj docHard copy of proj doc
Hard copy of proj doc
nawaldiatm
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
AkshatTiwari530170
 
Sahil Dhungel & Het Unadkat Data Mining.pdf
Sahil Dhungel & Het Unadkat Data Mining.pdfSahil Dhungel & Het Unadkat Data Mining.pdf
Sahil Dhungel & Het Unadkat Data Mining.pdf
HetUnadkat
 
Scope definition of ticketing automation bangladesh
Scope definition of ticketing automation bangladeshScope definition of ticketing automation bangladesh
Scope definition of ticketing automation bangladesh
Shakil Mahmood
 
Online Railway Reservation System
Online Railway Reservation SystemOnline Railway Reservation System
Online Railway Reservation System
Prince Kumar
 
Vignan SIS Transport.ppt
Vignan SIS Transport.pptVignan SIS Transport.ppt
Vignan SIS Transport.ppt
JaganS51
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
Sandip Murari
 
Commutetown
CommutetownCommutetown
Commutetown
cmdsolution
 
Commutetown
CommutetownCommutetown
Commutetown
cmdsolution
 
Commutetown
CommutetownCommutetown
Commutetown
cmdsolution
 
Atm project
Atm projectAtm project
cbse 12 computer science IP
cbse 12 computer science IPcbse 12 computer science IP
cbse 12 computer science IP
D. j Vicky
 
Ip bus Akshay
Ip bus AkshayIp bus Akshay
Ip bus Akshay
AkshayKalapgar
 
bus reservation.pptx
bus reservation.pptxbus reservation.pptx
bus reservation.pptx
SachinPatil722931
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
D. j Vicky
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
D. j Vicky
 

Similar to Bus transportation query report (20)

Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
 
Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
 
Visual c
Visual cVisual c
Visual c
 
cs project.docx investigatory computer science
cs project.docx investigatory computer sciencecs project.docx investigatory computer science
cs project.docx investigatory computer science
 
Hard copy of proj doc
Hard copy of proj docHard copy of proj doc
Hard copy of proj doc
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
 
Sahil Dhungel & Het Unadkat Data Mining.pdf
Sahil Dhungel & Het Unadkat Data Mining.pdfSahil Dhungel & Het Unadkat Data Mining.pdf
Sahil Dhungel & Het Unadkat Data Mining.pdf
 
Scope definition of ticketing automation bangladesh
Scope definition of ticketing automation bangladeshScope definition of ticketing automation bangladesh
Scope definition of ticketing automation bangladesh
 
Online Railway Reservation System
Online Railway Reservation SystemOnline Railway Reservation System
Online Railway Reservation System
 
Vignan SIS Transport.ppt
Vignan SIS Transport.pptVignan SIS Transport.ppt
Vignan SIS Transport.ppt
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
 
Commutetown
CommutetownCommutetown
Commutetown
 
Commutetown
CommutetownCommutetown
Commutetown
 
Commutetown
CommutetownCommutetown
Commutetown
 
Atm project
Atm projectAtm project
Atm project
 
cbse 12 computer science IP
cbse 12 computer science IPcbse 12 computer science IP
cbse 12 computer science IP
 
Ip bus Akshay
Ip bus AkshayIp bus Akshay
Ip bus Akshay
 
bus reservation.pptx
bus reservation.pptxbus reservation.pptx
bus reservation.pptx
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 

Recently uploaded

The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
yarusun
 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
Quizzito The Quiz Society of Gargi College
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
Friends of African Village Libraries
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
MattVassar1
 
What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17
Celine George
 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
MJDuyan
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
Sarojini38
 
Slides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptxSlides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptx
shabeluno
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
whatchangedhowreflec
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
Kalna College
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Catherine Dela Cruz
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
Kalna College
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
Celine George
 

Recently uploaded (20)

The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
 
What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17
 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
 
Slides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptxSlides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptx
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
 

Bus transportation query report

  • 1. Kendriya Vidyalaya No.1 Panambur, Mangalore Bus Transportation query Code in C++ Computer Science Project 2017-2018 BY~
  • 2. Transportation query Page 2 Sudhanshu B Moolya Umesh B Kumar Varshith M K Index 1. Certificate ……………………...............3 2. Acknowledgement………………. ........4 3. Introduction ………………………..……..5
  • 3. Transportation query Page 3 4. Exiting system.……………………..…….6 5. Objectives………….……………….. ………7 6. Function Specification…………........8 7. System requirement…………..…......9 8. Existing System………………………….10
  • 4. Transportation query Page 4 9. Data flow diagram…………………….…11 10. Header Files& Files Created.13 11. Sources code……………………..…......14 12. Output report………………........59 13. Sources and Bibliography…..71
  • 5. Transportation query Page 5 CERTIFICATE This is to certify that of Kendriya Vidyalaya No.1, Panambur has successfully completed the Computer science Annual Project on Bus Transportation Query C++ as per the rules of Central Board of Secondary Education for the academic year 2017-2018. Teacher in charge Principal [Mr.Sunil Kumar T ] [ ] External Examiner
  • 6. Transportation query Page 6 Acknowledgement I hereby acknowledge my deep sense of gratitude and indebtedness of the following personalities whose immense guidance, encouragement, necessary suggestions, initiations, enthusiasm and inspiration made this work a master art and a joint enterprise. Mrs. Alice Joseph - (Principal) Mr. Sunil Kumar .T (PGT Computer Science) And my classmates and friends.
  • 7. Transportation query Page 7 INTRODUCTION The Bus Ticket Reservation System is a C++ based application that allows visitors check bus ticket availability, buy bus ticket and pay the bus ticket . This system is established for all the home/office users after gaining access from the administrator. Online Bus Reservation System provides bus transportation system, a facility to reserved seats, cancellation of seats and different types of enquiry which need an instant and quick reservation. The use of bus traveling is a large growing business in many countries; hence bus reservation system deals with maintenance of records of each passenger who had reserved a seat for a journey. It also includes maintenance of information like schedule and details of each bus (Shivaji, 2010). Also, we get to know that there are many operations, which they have to do manually. It takes a lot of time and causes many errors. Due to this, sometimes a lot of problems occur and they were facing many disputes with customers. To solve the above problem, and further maintaining records of items, seat availability for customers, price of per seat, bill generation and other things, we are offering this proposal of reservation system.
  • 8. Transportation query Page 8 Existing System • The work is done manually. • Those who are interested in inquiring about the Bus Type, its Tickets Price, available seats, facility of the bus etc. has to walk to the Booking office. • This creates a huge Relief for the Customer of the Office on weekends to save their time.
  • 9. Transportation query Page 9 Objectives The objective of travel query in C++ is very vast. Mainly it is the Bus transportation query for which people use travel query. C++ programming helps us to know all the details about the bus reservation. It tells and helps people by giving details like bus name, boarding time, arrival time, ticket cost.
  • 10. Transportation query Page 10 Most importantly it also gives information about the seating arrangement and shows seat which is occupied as 0. It also facilitates ticket booking and cancellation. FUNCTIONAL SPECIFICATION
  • 11. Transportation query Page 11 User • This Project basically provides a Bus information and regarding bus information. • User who’re not registered should sign up and user who’re already signed can login for further process. • User can search bus based on where he want to go and where to board into the bus. • Users can also choose his own seats in bus by seeing the seating arrangement of the bus. Admin • A person can only register as admin into the system only if he known verification password of admin • In this system admin, can maintain all the Bus information and also maintain Bus details, addition of new bus details, etc. • In this system admin, can maintain the, and also admin can generate a report and managethe whole system.
  • 12. Transportation query Page 12 Hardware Requirement(Minimum) Minimum Server Requirement: Minimum Client Requirement: Processor 2 GHZ RAM 500 MB Disk Space 20 GB of Free Space Software Requirement(Minimum) Server Software Requirement: Operating System Windows server 2003 Front End C++ Back End SQL Server 2005 Client Software Requirement: Processor 1 GHZ RAM 2 TB Disk Space Disk Space
  • 13. Transportation query Page 13 Operating System Windows Xp or Any equivalent OS Existing System • The work is done manually. • Those who are interested in inquiring about the Bus Type, its Tickets Price, available seats, facility of the bus etc. has to walk to the Booking office. • This creates a huge Relief for the Customer of the Office on weekends to save their time.
  • 14. Transportation query Page 14 Data Flow Diagram
  • 16. Transportation query Page 16 Header Files and Files created Header Files 1.#include <iostream> 2.#include <string.h> 3.#include <fstream> 4.#include <conio.h> 5.#include <stdio.h> 6.#include <stdlib.h> Files created private.dat ->a data file which store’s the admin id and password private2.dat ->a data file which store’s the user id and password database.dat->a data file which store’s the bus details.
  • 17. Transportation query Page 17 passengerdetail.dat->a data file which store’s the details of the passenger. SOURCE CODE #include <iostream> #include <string.h> #include <fstream> #include <conio.h> #include <stdio.h> #include <stdlib.h> using namespace std; void vline(char ch);
  • 18. Transportation query Page 18 int sr=0; class reg_log { char name[30], username[30], password[30], adminpass[30]; int verified; public: int identify; char usern[30], pass[30], a[30]; reg_log() { strcpy(adminpass,"project"); } int verification() {
  • 19. Transportation query Page 19 return(verified); } char* passwords() { return(password); } char* idname() { return(username); } int indentification(); void regis(); }admin,user; int reg_log::indentification()
  • 20. Transportation query Page 20 { char pass[30], a[30]; cout<<"nnEnter the admin password for verification : ";gets(a); gets(pass); if(strcmp(pass,adminpass)==0) { identify=0; return (identify); } } void reg_log::regis() { int i; if(identify==0)
  • 21. Transportation query Page 21 { cout<<"nnEnter your name : "; gets(name); cout<<"nnEnter your user name : "; gets(username); cout<<"nnEnter your password : "; for(i=0; ;++i) { password[i]=getch(); cout<<"*"; if(password[i]==13) { password[i]='0'; break; }
  • 22. Transportation query Page 22 } cout<<"nn Enter any key to continue........"; getch(); }verified=1; } class ticket { char name[30], email[40], gender; int phoneno[10], pnr[2], seatno; public: void input(int, int); void display(); int pnr_num1() {
  • 23. Transportation query Page 23 return(pnr[0]); } int pnr_num2() { return(pnr[1]); } }tic; void ticket::input(int seat, int busnum) { int i; pnr[0]=seat; pnr[1]=busnum; seatno=seat; cout<<"nnEnter your name ";
  • 24. Transportation query Page 24 gets(name); cout<<"nEnter your email "; gets(email); cout<<"nEnter your gender (enter m->male, f->female)"; cin>>gender; cout<<"nEnter your phoneno"; for(i=0;i<10;++i) cin>>phoneno[i]; cout<<"nnNOTE-YOUR PNR NUMBER IS ->"<<pnr[0]<<" "<<pnr[1]; cout<<endl; } void ticket::display() { int i;
  • 25. Transportation query Page 25 cout<<"nn NAME - "; puts(name); cout<<"n PNR NUMBER - "<<pnr[0]<<" "<<pnr[1]; cout<<"n EMAIL ADDRESS - "; puts(email); cout<<" Gender - "<<gender; cout<<"n PHONE NUMBER - "; for(i=0;i<10;++i) cout<<phoneno[i]; cout<<"n SEAT NUMBER - "; cout<<seatno; } class database
  • 26. Transportation query Page 26 { char busname[30], bustype[30], from[30], to[30], btime[6],dtime[6]; int busno, seat[10][50], row, col; float price; public: void install(); void show(); void print(); int search_it() { return(busno); } void print_seat(); int showbus(); void searchb();
  • 27. Transportation query Page 27 }bobj; void database::install() //this function is for entering bus details { int i, j, num=0; char a[20]; cout<<"nEnter bus no: "; cin>>busno; cout<<"nEnter the bus name: ";gets(a); gets(busname);
  • 28. Transportation query Page 28 cout<<"nEnter the bus type: "; gets(bustype); cout<<"nBoarding time: "; gets(btime); cout<<"nDropping time: "; gets(dtime); cout<<"nFrom: ttt"; gets(from); cout<<"nTo: ttt"; gets(to);
  • 29. Transportation query Page 29 cout<<"nNumber of rows and column of seats"; cin>>row>>col; for(i=0;i<row;++i) { for(j=0;j<col;++j) { ++num; seat[i][j]=num; //this is to saw that the seat is empty } } cout<<"nCost of ticket per adult: "; cin>>price;
  • 30. Transportation query Page 30 } void database::show() { cout<<"n"<<busno<<"t "<<busname<<"t "<<bustype<<"t "<<btime<<"t "<<dtime<<"t "<<from<<" "<<to<<"n"; } void database::print() { cout<<"nn Bus no:"<<busno <<"n Bus name:"<<busname <<"n Bus type:"<<bustype <<"n Boarding time:"<<btime
  • 31. Transportation query Page 31 <<"n Dropping time:"<<dtime <<"n From:"<<from <<"n To"<<to <<"n Price per person"<<price; } void database::print_seat() { int i,j; for(i=0;i<row;++i) { for(j=0;j<col;++j) { cout<<seat[i][j]<<" "; }
  • 32. Transportation query Page 32 cout<<endl; } } int database::showbus() { int busnum; char tempfrom[15], tempto[15], ch[15]; cout<<"Enter the place name from where you need to catch the bus :";gets(ch); gets(tempfrom); cout<<"Enter the place name where you want to go :"; gets(tempto); cout<<"nthese are the bus that you can travel inn"; fstream fobj; fobj.open("database.dat",ios::in|ios::binary);
  • 33. Transportation query Page 33 while(fobj.read((char*)&bobj,sizeof(database))) { if((strcmp(from,tempfrom)==0)&&(strcmp(to,tempto)==0)) { vline('+'); print(); cout<<"nSeating arrangement in the bus is as shown belown('0' means the seat is occupied)n"; print_seat(); vline('+'); } } cout<<"nnEnter the bus no. whose ticket you want"; cin>>busnum; fobj.close();
  • 34. Transportation query Page 34 return(busnum); } void database::searchb() { int num, no_tic, temp[25], a[10], i , j, total, opt, k=0, flag=0; char ch[15]; long int p; num=bobj.showbus(); cout<<"enter the number of ticket's you want"; cin>>no_tic; fstream fobj, pobj; fobj.open("database.dat",ios::in|ios::out|ios::binary); pobj.open("passengerdetail.dat",ios::out|ios::binary);
  • 35. Transportation query Page 35 while(!fobj.eof()) { p=fobj.tellp(); fobj.read((char*)&bobj,sizeof(database)); if(num==bobj.search_it()) { cout<<endl; print_seat(); while(k<no_tic) { cout<<"nEnter the seat number(see the above pic and enter,'0' means the seat is occupied)"; cin>>temp[k]; for(i=0;i<row;++i) { for(j=0;j<col;++j)
  • 36. Transportation query Page 36 { if(temp[k]==seat[i][j]) { if(seat[i][j]!=0) { cout<<"nnEnter the passenger's detail"; gets(ch); tic.input(seat[i][j],num); seat[i][j]=0; pobj.write((char*)&tic,sizeof(ticket)); } else if(seat[i][j]==0) { cout<<"nnthis seat is already booked"; --k;
  • 37. Transportation query Page 37 getch(); } } } } ++k; print_seat(); } total=no_tic*price; cout<<"nntotal price ="<<total; cout<<"nnEnter 1 to buy the ticket or Enter 2 to go back to user page"; cin>>opt; switch(opt) {
  • 38. Transportation query Page 38 case 1: cout<<"nnthank you for buying the ticket & have a happy journey :) "; print_seat(); fobj.seekp(p,ios::beg); fobj.write((char*)&bobj,sizeof(database)); cout<<endl<<"The bus Record Updated Successfully...n"; break; case 2: break; } } } pobj.close(); fobj.close();
  • 39. Transportation query Page 39 getch(); } void vline(char ch) { for (int i=80;i>0;i--) cout<<ch; }
  • 40. Transportation query Page 40 void delete_bus(int); int main() { int opt1, opt2, opt3, num1, num2, bno, num[10]; void regi_admin(); void regi_user(); int login_admin(); int login_user(); void new_bus(); void print_bus(); void print1_bus(); void edit_bus(); void search_bus();
  • 41. Transportation query Page 41 void display_tic(int num[10]); void print_tic(int num[10]); void cancel_tic(int num[10]); do { system("CLS"); cout<<"ntttSUV TRAVELSntt****************************" <<"nnttt MENU" <<"nnt 1. Register" <<"nt 2. Login as admin" <<"nt 3. Login as user" <<"nt 4. Exit"; cout<<"nnt Enter your choice : "; cin>>opt1;
  • 42. Transportation query Page 42 switch(opt1) { case 1: int opt; cout<<"nnt 1. To register as admin"; cout<<"nt 2. To register as user"; cout<<"nnt Enter your choice : "; cin>>opt; switch(opt) { case 1: regi_admin(); break; case 2: regi_user();
  • 43. Transportation query Page 43 break; } break; case 2: num1=login_admin(); if(num1==1) { do { system("CLS"); cout<<"nttt ADMIN MENUn" <<"nnt1. Add new bus detail" <<"nt2. Printing all bus details" <<"nt3. Printing a particular bus detail" <<"nt4. Editing the bus record"
  • 44. Transportation query Page 44 <<"nt5. Deleting a bus record" <<"nt6. Sign out" <<"nntEnter your choice"; cin>>opt2; switch(opt2) { case 1: new_bus(); break; case 2: print_bus(); break; case 3: print1_bus(); break;
  • 45. Transportation query Page 45 case 4: edit_bus(); break; case 5: { cout<<"nEnter the bus no. of the bus whose Record is to be Deleted:"; cin>>bno; delete_bus(bno); break; } } }while(opt2!=6); } break; case 3:
  • 46. Transportation query Page 46 num2=login_user(); if(num2==1) { do { system("CLS"); cout<<"nttt USER MENUn" <<"nnt1. Booking a ticket" <<"nt2. Display ticket" <<"nt3. Cancel ticket" <<"nt4. Print ticket" <<"nt5. Sign out" <<"nnt Enter your choice : "; cin>>opt3; switch(opt3)
  • 47. Transportation query Page 47 { case 1: bobj.searchb(); break; case 2: cout<<"nnEnter your pnr number to access your ticket details"; cin>>num[0]>>num[1]; display_tic(num); cout<<"nnEnter any key to go back to user page"; getch(); break; case 3: cout<<"nnEnter your pnr number to access your ticket details for canceling";
  • 48. Transportation query Page 48 cin>>num[0]>>num[1]; cancel_tic(num); break; case 4: cout<<"nnEnter your pnr number to access your ticket details"; cin>>num[0]>>num[1]; print_tic(num); break; } }while(opt3!=5); } break; } }while(opt1!=4);
  • 49. Transportation query Page 49 return 0; } void regi_admin() { int identify; cout<<"nt To register as admin "; fstream adobj; adobj.open("private.dat",ios::out|ios::app|ios::binary); identify=admin.indentification(); if(identify==0) { admin.regis(); adobj.write((char*)&admin,sizeof(reg_log)); adobj.close();
  • 50. Transportation query Page 50 } } void regi_user() { cout<<"ntTo register as user "; fstream usobj; usobj.open("private2.dat",ios::out|ios::app|ios::binary); user.regis(); usobj.write((char*)&user,sizeof(reg_log)); usobj.close(); } int login_admin() {
  • 51. Transportation query Page 51 int ch=0,i; cout<<"nttLOGIN PAGEn"; char password[15], a[15]; fstream f; f.open("private.dat",ios::in|ios::out|ios::binary); char id[100]; cout<<"nn Enter your id:";gets(a); gets(id); cout<<"n Enter your password : "; for(i=0; ;++i) { password[i]=getch();
  • 52. Transportation query Page 52 cout<<"*"; if(password[i]==13) { password[i]='0'; break; } } while(f.read((char *) & admin,sizeof(reg_log))) { if((strcmp(admin.idname(),id)==0)&&(strcmp(admin.passwords(), password)==0)) { ch=1; } } f.close();
  • 53. Transportation query Page 53 return(ch); } int login_user() { int ch=0,i; cout<<"nttLOGIN PAGEn"; char password[15], a[15]; fstream f; f.open("private2.dat",ios::in|ios::out|ios::binary); char id[100]; cout<<"nn Enter your id:";gets(a);
  • 54. Transportation query Page 54 gets(id); cout<<"n Enter your password : "; for(i=0; ;++i) { password[i]=getch(); cout<<"*"; if(password[i]==13) { password[i]='0'; break; } } while(f.read((char *) & user,sizeof(reg_log))) { if((strcmp(user.idname(),id)==0)&&(strcmp(user.passwords(),pass word)==0))
  • 55. Transportation query Page 55 { ch=1; } } f.close(); return(ch); } void new_bus() { char a; fstream fobj; fobj.open("database.dat",ios::out|ios::app|ios::binary); do
  • 56. Transportation query Page 56 { bobj.install(); fobj.write((char*)&bobj,sizeof(database)); cout<<endl<<"nThe details of the bus is Created in the File...nn"; cout<<endl<<"Do You Want to Add Another Record(Y/N):"; a=getche(); }while(a=='y'||a=='Y'); fobj.close(); cout<<"n Press any key to continue..."; getch(); } void edit_bus()
  • 57. Transportation query Page 57 { cout<<"n Program for Modifying a bus Recordn"; fstream fobj; int num; long int p; fobj.open("database.dat",ios::in|ios::out|ios::binary); int flag=0; cout<<"nInput the busNo.of the bus which you want to Modify:"; cin>>num; while(!fobj.eof()) { p=fobj.tellp(); fobj.read((char*)&bobj,sizeof(database)); if(num==bobj.search_it())
  • 58. Transportation query Page 58 { vline('+'); bobj.print(); cout<<"nSeating arrangement in the bus is as shown belown('0' means the seat is occupied)n"; bobj.print_seat(); vline('+'); bobj.install(); fobj.seekp(p,ios::beg); fobj.write((char*)&bobj,sizeof(database)); cout<<endl<<"The bus Record Updated Successfully...n"; flag=1; break; }
  • 59. Transportation query Page 59 } if(flag==0) cout<<"n bus record is Not Found...n"; cout<<"n Press any key to continue..."; getche(); fobj.close(); } void print_bus() { fstream fobj; fobj.open("database.dat",ios::in|ios::binary); vline('+'); cout<<"nBus no: Bus name Bus type: Arrival time: Departure time: From: t To:n";
  • 60. Transportation query Page 60 vline('+'); while(fobj.read((char*)&bobj,sizeof(database))) { ++sr; bobj.show(); } sr=0; fobj.close(); cout<<"n Press any key to continue..."; getche(); } void print1_bus() {
  • 61. Transportation query Page 61 int bnum; fstream fobj; fobj.open("database.dat",ios::in|ios::binary); int flag=0; cout<<endl<<"Enter the Bus.No. of the bus which you want to Search:"; cin>>bnum; while(fobj.read((char*)&bobj,sizeof(database))) { if(bnum==bobj.search_it()) { cout<<endl<<"Bus Record is Found in the File...Details are given belown"; vline('+'); bobj.print();
  • 62. Transportation query Page 62 cout<<"nSeating arrangement in the bus is as shown belown('0' means the seat is occupied)n"; bobj.print_seat(); cout<<endl; vline('+'); flag=1; } } if(flag==0) cout<<"n Sorry...The bus Record with the Bus No. "<<bnum<<" Not Found in the Filen"; fobj.close(); cout<<"n Press any key to continue..."; getche(); }
  • 63. Transportation query Page 63 void delete_bus(int bno) { fstream fobj,fout; fobj.open("database.dat",ios::in|ios::binary); fout.open("temp.dat",ios::out|ios::binary); char found='f'; int confirm=0; while(fobj.read((char*)&bobj,sizeof(database))) { if(bno==bobj.search_it()) { bobj.show(); found='t'; cout<<"nConfirmation of Deletion press 1 to Delete or 0 to Cancel"; cin>>confirm;
  • 64. Transportation query Page 64 if(confirm==0) { fout.write((char*)&bobj,sizeof(database)); } else { cout<<"nnnn The Bus Record is Deleted...n"; } } else fout.write((char*)&bobj,sizeof(database)); } if(found=='f') cout<<endl<<"Student Record Not Found...n";
  • 65. Transportation query Page 65 fobj.close(); fout.close(); remove("database.dat"); rename("temp.dat","database.dat"); cout<<"n Press any key to continue..."; getche(); } void display_tic(int num[10]) { fstream fobj, pobj; pobj.open("passengerdetail.dat",ios::in|ios::binary); while(pobj.read((char*)&tic,sizeof(ticket)))
  • 66. Transportation query Page 66 { if(num[0]==tic.pnr_num1()&&num[1]==tic.pnr_num2()) { cout<<endl; vline('+'); cout<<"nttSUV travels"; tic.display(); num[0]=tic.pnr_num1(); num[1]=tic.pnr_num2(); } } getch(); pobj.close(); fobj.open("database.dat",ios::in|ios::binary); while(fobj.read((char*)&bobj,sizeof(database)))
  • 67. Transportation query Page 67 { if(num[1]==bobj.search_it()) { bobj.print(); cout<<endl; vline('+'); } } fobj.close(); } void print_tic(int num[10])
  • 68. Transportation query Page 68 { fstream fobj, pobj, printer; fobj.open("database.dat",ios::in|ios::binary); pobj.open("passengerdetail.dat",ios::in|ios::binary); printer.open("pnr",ios::out); while(pobj.read((char*)&tic,sizeof(ticket))) { if(num[0]==tic.pnr_num1()&&num[1]==tic.pnr_num2()) { cout<<endl; vline('+'); cout<<"nttSUV travels"; tic.display(); printer.write((char*)&tic,sizeof(ticket));
  • 69. Transportation query Page 69 num[0]=tic.pnr_num1(); num[1]=tic.pnr_num2(); } } while(fobj.read((char*)&bobj,sizeof(database))) { if(num[1]==bobj.search_it()) { bobj.print(); printer.write((char*)&bobj,sizeof(database)); vline('+'); } } fobj.close(); pobj.close();
  • 70. Transportation query Page 70 } void cancel_tic(int pnr[2]) { fstream fobj,fout; fobj.open("passengerdetail.dat",ios::in|ios::binary); fout.open("temp.dat",ios::out|ios::binary); char found='f'; int confirm=0; while(fobj.read((char*)&tic,sizeof(ticket))) { if(pnr[0]==tic.pnr_num1()&&pnr[1]==tic.pnr_num2()) {
  • 71. Transportation query Page 71 display_tic(pnr); found='t'; cout<<"nConfirmation of Deletion press 1 to Delete or 0 to Cancel"; cin>>confirm; if(confirm==0) { fout.write((char*)&tic,sizeof(ticket)); } else { cout<<"nnnn The passenger Record is Deleted...n"; } } else
  • 72. Transportation query Page 72 fout.write((char*)&tic,sizeof(ticket)); } if(found=='f') cout<<endl<<"passenger Record Not Found...n"; fobj.close(); fout.close(); remove("passengerdetail.dat"); rename("temp.dat","passengerdetail.dat"); cout<<"n Press any key to continue..."; getche(); } OUTPUT REPORT
  • 74. Transportation query Page 74 REGISTERATION
  • 75. Transportation query Page 75 LOGIN PAGE
  • 76. Transportation query Page 76 ADMIN MENU
  • 77. Transportation query Page 77 ADD NEW BUS DETAIL
  • 78. Transportation query Page 78 PRINTING ALL BUS DETAILS
  • 79. Transportation query Page 79 PRINTING A PARTICULAR BUS DETAILS
  • 80. Transportation query Page 80 EDITING THE BUS RECORD
  • 81. Transportation query Page 81 DELETING BUS RECORD USER MENU
  • 82. Transportation query Page 82 FOR BOOKING A TICKET
  • 83. Transportation query Page 83 DISPLAY YOUR TICKET DETAILS
  • 84. Transportation query Page 84 CANCELATION OF TICKET
  • 85. Transportation query Page 85 Sources and Bibliography The basic idea of the project is evolved after the system study of the bus query system from the website redbus.com. For programming concepts and functions  Computer Science with C++ By SumitaArora  The C++ Programming Language Book by Bjarne Stroustrup  Programming: Principles and Practice Using ...Book by Bjarne Stroustrup
  翻译: