You are on page 1of 19

TRAVELIG AGENGY

PRESENTED BY:

BASHAR ALI, AWS ISMAIL,

& KAMAL SALEH

2ND STAGE (EVENING STUDY)

DR. OMAR YOUSSEF


TABLE OF CONTENTS:

INTRODUCTION……………………………………………………2

ABSTRACT…………………………………………………………. 2

SCOPE …………………………………………………………. 3

SOFTWARE REQUIREMENT ……………………………………….4-5

SYSTEM DESIGN ………………………………………….…5-6

OUTPUT…………………….………………….6-8

HEADER ……………………………………………….8-10

FUTURE & CONCLUSION …………………………..11

CODE………………………………………………………12-18

2|P a g e
TRAVELING AGENGY

ABSTRACT:

The project explained here is very useful in maintaining the


customer’s details and can work on the existing records of customer
details. The workload of the travel agency manager is also considerably
reduced. In the near future, the online registration can be implemented. 

Introduction:

Now a day every traveling agency manager has need to


maintaining customer details. For this purpose, need the software which
could easily and conveniently maintain the customer details.

The record of customer can be stored in the single file. This software can
be used in several traveling agencies for keeping the records of the
customer and also used to add record of school trip, government officer
Holiday, family trip and large industries traveling record.

This project “traveling agency” includes some facilities of travel such as


registration, search, display, modification, delete etc. This software
searches the client data which is store in the record.

The software used for arranging travel services, provide new and
improved services, and identify travel related cost savings.

3|P a g e
SCOPE OF PROJECT:

 The aim of project is to provide the traveling services to the


customers at reasonable rate. Through this project provide the
facilities to the customer such as registration, display, search, modify,
delete etc.

 Registration of new customer:

In Registration option add the client information such as client name,


address, client no, phone no, total cost of travels, date of registration

 Display:

In Display option, read the all client information such as client no,
client name, address, phone no and cost.

 Search:

In search option, search the information about particular client, such


as client no client name, phone no, date of registration and cost.

 Modify:

In modify option, update the particular client no, name, address,


phone no and cost.

 Delete:

In delete option, delete the record of particular client no, name,


address, phone no cost and date of registration.

4|P a g e
software requirement specification

1. Functionality:

The functionality requirment specify which output should be


produced from the given input.

In “Traveling agency’’ project , enter the input as all personal


data (name, address, phone no, date) & traveling information & give
desired output as total cost of traveling.

2. Performance:

This part of SRS specifies performance constraints on the software


system.

All the requirement relating to the performance characteristics of the


system must be clearly specified.

3.Design constraints:

There are number of factors in the client environment that may restrict the
choices of designer.

4.External interface :

All possible interactions of the software with client, hardware & other
software should be clearly specified.

5|P a g e
Hardware requirements:

Minimum requirements of 64 MB RAM.

Software requirements:

C++

Windows os

SYSTEM DESIGN:

In Registration option add the client information such as client name,


address, client no, phone no, total cost of travels, date of registration.

Following calculations are carried out to calculate the total cost of travels:

1) travels of yellow board:

Total cost of travels=((per km+Temporary


pervana(TP))*(total km))
6|P a g e
2) travels of white board:Total cost of travels =(per km*total km)

Output:

1)REGISTRATION.

2)DISPLAY

7|P a g e
3)SERACH

4)MODIFY

8|P a g e
5)DELETE

HEADER FILES ARE USED:

There are the following library functions which are used in this program.
The uses of these functions are also given below:

1.#include<iostream.h>

This header file contains all the standard input and output functions.

cin>>=It is used for scan the data. This is same as scanf function .

cout<<=It is used for print the data.This is same as printf function .

9|P a g e
2.#include<conio.h>

This header file contains console input output functions.

e.g.

 getch(): it gets the character from the console. It reads a single


character directly from the keyboard, without echoing it on the
screen.

 void main():-When used as a function return type, void means that


the function does not return a value.

 gotoxy():- It moves the cursor to the given position in the current


text window. If the coordinates are invalid, the call gotoxy() is
ignored.

 clrscr():-It clears the current text window and place the cursor in the
upper left hand corner.

3.#include<process .h>

 exit():-It terminates the calling process. Before termination exit does


the following:

1. close all files.

2. Writes buffered output.(waiting to be output)

3. call any registered”exit function”.

4.#include<string .h>

This header file contains function prototypes for c-style string processing
functions.

10 | P a g e
 Constant, data type and global variable are used for some
comparisons of character, check length for character.

5.#include<ctype.h>

This header file contains function prototypes for functions that test
characters for

certain properties, and function prototypes for functions that can be used
to convert lowercase letters to uppercase letters and vice versa.

 This header file is used for validation such as name


validation,phone validation etc.

6.#include<dos.h>

 Include the date in project using dos header file.

Data d;

7.#include<fstream.h>

This header file contains function prototypes for functions that perform
input from files on disk and output to files on disk.

8.#include<stdio.h>

This header file contains function prototypes for the standarad input/output
library functions and information used by them.

9.#include<graphics.h>

This header file contains graphics function.

e.g. outtextxy(), setcolor(), settextstyle().

11 | P a g e
FUTURE ENHANCEMENT

1-Modify this system to perform additional operations such as modification the Registrat

of travels etc.

2-This system will be extended in future to handle number of places and also provide
more

Vehicles.

3-In future the system can be done online

CONCLUSION

This software is efficient in maintaining customer’s details and can


easily perform operations on customer’s records. This software also
reduces the work load of the travel agency manager.

In future, this system can launch web site for easy online registration. In
this system there is limitation for places and vehicles. In future, it can be
extended to add more place and vehicles.

12 | P a g e
Code:

conn = system("color 0f"); cout << "Choose One:


#include<iostream> mysql_real_connect(con // Initial Load End ";
#include<cstdio> n, "localhost", "root", "", cin >>
#include<fstream> "cpp_travelagency_db", // Call Methods chooseOneFromMenu;
#include<sstream> 0, NULL, 0);
#include<string> if (conn) db_response::Connectio switch
#include<cstdlib> { nFunction(); (chooseOneFromMenu)
#include<conio.h> cout << // Call Methods End {
#include<windows.h> "Database Connected To case 1:
#include<mysql.h> MySql" << conn << // Variables NewTravelTrip();
using namespace std; endl; int break;
cout << "Press chooseOneFromMenu = case 2:
// Global Variable any key to continue..." 0; ShowUsers();
int qstate; << endl; char exitSurity; break;
MYSQL* conn; //getch(); // Variables End case 3:
MYSQL_ROW row; system("cls"); FindUser();
MYSQL_RES* res; } cout << "Welcome To break;
// Global Variable End else Travel Agency case 4:
cout << "Failed Management System" EditUser();
class db_response To Connect!" << << endl << endl; break;
{ mysql_errno(conn) << cout << "Travel case 5:
public: endl; Agency Management DeleteUser();
static void } Menu" << endl; break;
ConnectionFunction() }; cout << "1. New case 6:
{ Travel Trip." << endl; AddTrip();
conn = // Functions cout << "2. Show break;
mysql_init(0); void NewTravelTrip(); Users." << endl; case 7:
if (conn) void ShowUsers(); cout << "3. Find EditTrip();
{ void FindUser(); User." << endl; break;
cout << void EditUser(); cout << "4. Edit case 8:
"Database Connected" void DeleteUser(); User." << endl; DeleteTrip();
<< endl; void AddTrip(); cout << "5. Delete break;
cout << "Press void EditTrip(); User." << endl; case 9:
any key to continue..." void DeleteTrip(); cout << "6. Add ExitProgram:
<< endl; // Functions End Trip." << endl; cout << "Program
//getch(); cout << "7. Edit terminating. Are you
system("cls"); int main() Trip." << endl; sure? (y/N): ";
} { cout << "8. Delete cin >> exitSurity;
else // Initial Load Trip." << endl; if (exitSurity == 'y'
cout << "Failed system("cls"); cout << "9. Exit." << || exitSurity == 'Y') {
To Connect!" << system("title Travel endl; return 0;
mysql_errno(conn) << Agency Management
endl; System Program");
13 | P a g e
}else if (exitSurity cout << "New Travel } cout << "Query
== 'n' || exitSurity == Trip Menu" << endl << else Execution Problem!" <<
'N') { endl; { mysql_errno(conn) <<
system("cls"); cout << "Query endl;
main(); cin.ignore(1, '\n'); Execution Problem!" << }
}else { cout << "Enter User mysql_errno(conn) <<
cout << "Next Name: "; endl; // Exit Code
time choose after read getline(cin, } cout << "Press 'm' to
the corresponding line." userName); cout << "Enter Trip Menu and 'a' to Insert
<< endl; cout << "Enter User Id: "; Again Or Any Other key
goto Address: "; getline(cin, to exit: ";
ExitProgram; getline(cin, userTripPlanId); cin >> choose;
} userAddress); for (int i = 0, j = 0, k if (choose == 'm' ||
break; cout << "Enter Phone = 1; i < storeIndex1; i+ choose == 'M')
default: No.: "; +) {
cout << "Please getline(cin, { main();
choose between 1 - 7. userPhone); if }
Press Enter To cout << "Enter Email: (storeUserTripPlan[i][j] else if (choose == 'a' ||
Continue..."; "; == userTripPlanId) choose == 'A')
getch(); getline(cin, { {
system("cls"); userEmail); userTripPlan = NewTravelTrip();
main(); cout << "Enter Trip storeUserTripPlan[i][k]; }
break; Date: "; break; else
} getline(cin, } {
return 0; userTripDate); } exit(0);
} qstate = cout << "Enter Trip }
//Project By mysql_query(conn, Cost: ";
CodeWithC.com "select * from getline(cin, }
// Functions travelagencytrips_tb"); userTripCost);
void NewTravelTrip() if (!qstate) void ShowUsers()
{ { string insert_query = {
// Initial Load res = "insert into // Initial Load
system("cls"); mysql_store_result(conn travelagency_tb system("cls");
// Initial Load End ); (t_username, // Initial Load End
t_useraddress,
// Variables printf("--------------------- t_userphone, // Variables
string userName = ""; ------------------------------ t_useremail, char choose;
string userAddress = ------\n"); t_usertripdate, // Variables End
""; printf("| %-10s | %- t_usertripplan,
string userPhone = ""; 40s |\n", "Trip Id", "Trip t_usertripcost) values cout << "Welcome To
string userEmail = ""; Name"); ('"+userName+"','"+user Travel Agency
string userTripDate = while ((row = Address+"','"+userPhone Management System"
""; mysql_fetch_row(res))) +"','"+userEmail+"','"+u << endl << endl;
string userTripPlanId { serTripDate+"','"+userTr cout << "Show Users
= ""; printf("| %-10s | ipPlan+"','"+userTripCo Menu" << endl << endl;
string userTripPlan = %-40s |\n", row[0], st+"')";
""; row[1]); qstate =
string userTripCost = const char* q = mysql_query(conn,
""; storeUserTripPlan[storeI insert_query.c_str(); // "select * from
char choose; ndex1][storeIndex2] = c_str converts string to travelagency_tb");
// Variables End row[0]; constant char and this is if (!qstate)
storeIndex2++; required {
// Store Variables res =
string qstate = mysql_store_result(conn
storeUserTripPlan[storeI
storeUserTripPlan[500] mysql_query(conn, q); );
ndex1][storeIndex2] =
[500]; while ((row =
row[1];
int storeIndex1 = 0, if (!qstate) mysql_fetch_row(res)))
storeIndex1+
storeIndex2 = 0; { {
+;storeIndex2--;
// Store Variables End cout << endl << cout << "User
}
"Successfully added in Name: " << row[1] <<
cout << "Welcome To database." << endl; "\nUser Address: " <<
Travel Agency printf("--------------------- } row[2] << "\nUser
Management System" ------------------------------ else Phone: " << row[3] <<
<< endl << endl; ------\n"); { "\nUser Email: " <<
14 | P a g e
row[4] << "\nTrip Date: qstate = string userEmail = "";
" << row[5] << "\nTrip mysql_query(conn, qn); string userTripDate = printf("---------------------
Plan: " << row[6] << ""; ------------------------------
"\nTrip Cost: " << cout << endl; string userTripPlanId ------------------------------
row[7] << endl << endl; if (!qstate) = ""; ------------------------------
} { string userTripPlan = --\n");
} res = ""; printf("| %-10s | %-
else mysql_store_result(conn string userTripCost = 25s | %-25s | %-40s |\n",
{ ); ""; "Column ID", "User
cout << "Query while ((row = string items[5000]; Name", "Trip Date",
Execution Problem!" << mysql_fetch_row(res))) char choose; "Trip Plan");
mysql_errno(conn) << { int itemId; while ((row =
endl; cout << "User bool HaveException mysql_fetch_row(res)))
} Name: " << row[1] << = false; {
"\nUser Address: " << bool NotInDatabase = printf("| %-10s |
// Exit Code row[2] << "\nUser false; %-25s | %-25s | %-40s
ExitMenu: Phone: " << row[3] << int indexForId = 0; |\n", row[0], row[1],
cout << "Press 'm' to "\nUser Email: " << row[5], row[6]);
Menu and any other key row[4] << "\nTrip Date: // Store Variables }
to Exit: "; " << row[5] << "\nTrip string storeColumnId
cin >> choose; Plan: " << row[6] << = ""; printf("---------------------
if (choose == 'm' || "\nTrip Cost: " << string storeUserName ------------------------------
choose == 'M') row[7] << endl << endl; = ""; ------------------------------
{ } string ------------------------------
main(); } storeUserAddress = ""; --\n");
} else string storeUserPhone }
else { = ""; else
{ cout << "Query string storeUserEmail {
exit(0); Execution Problem!" << = ""; cout << "Query
} mysql_errno(conn) << string Execution Problem!" <<
} endl; storeUserTripDate = ""; mysql_errno(conn) <<
} string endl;
void FindUser() storeUserTripPlanId = }
{ ExitMenu: "";
// Initial Load cout << "Press 'm' to string try
system("cls"); Menu, 'a' to Search storeUserTripPlan = ""; {
// Initial Load End again and any other key string cout << endl;
to Exit: "; storeUserTripCost = ""; cout << "Enter
// Variables cin >> choose; string Item Column ID: ";
string input = ""; if (choose == 'm' || storeUserTripPlan2d[50 cin >> itemId;
char choose; choose == 'M') 0][500]; cout << endl;
// Variables End { int storeIndex1 = 0, }
main(); storeIndex2 = 0; catch (exception e)
cout << "Welcome To } // Variables End {
Travel Agency else if (choose == 'a' || cout << "Please
Management System" choose == 'A') cout << "Welcome To Enter a valid
<< endl << endl; { Student Fee Inquiry NUMBER." << endl;
cout << "Show Users FindUser(); Program" << endl << HaveException =
Menu" << endl << endl; } endl; true;
else cout << "Edit Student goto ExitMenu;
cin.ignore(1, '\n'); { Record" << endl; }
cout << "Enter User exit(0);
Name: "; } if (HaveException ==
getline(cin, input); } qstate = false)
string mysql_query(conn, {
findbyname_query = void EditUser() "select * from stringstream
"select * from { travelagency_tb"); streamid;
travelagency_tb where system("cls"); if (!qstate) string strid;
t_username like { streamid << itemId;
'%"+input+"%'"; // Variables res = streamid >> strid;
const char* qn = string userName = ""; mysql_store_result(conn
findbyname_query.c_str string userAddress = ); for (int i = 0; i <
(); ""; indexForId; i++)
string userPhone = "";
15 | P a g e
{ if (userEmail == cout <<
if (strid != storeUserEmail = "X") "Query Execution
items[i]) row[4]; { Problem!" <<
{ userEmail = mysql_errno(conn) <<
NotInDatabase storeUserTripDate = storeUserEmail; endl;
= true; row[5]; } }
}else cout << "Enter cin.ignore(1,
{ User Trip Date (X to not '\n');
storeUserTripPlan =
NotInDatabase change): "; cout << "Enter
row[6];
= false; cin >> Trip Id (X to not
break; userTripDate; change): ";
} storeUserTripCost = if (userTripDate getline(cin,
} row[7]; == "X") userTripPlanId);
} { if
if (NotInDatabase } userTripDate (userTripPlanId == "X")
== false) else = storeUserTripDate; {
{ { } userTripPlan =
string cout << storeUserTripPlan;
findbyid_query = "select "Query Execution qstate = }
* from travelagency_tb Problem!" << mysql_query(conn, else
where t_id = mysql_errno(conn) << "select * from {
'"+strid+"'"; endl; travelagencytrips_tb"); for (int i = 0, j
const char* qi = } if (!qstate) = 0, k = 1; i <
findbyid_query.c_str(); { storeIndex1; i++)
qstate = cin.ignore(1, res = {
mysql_query(conn, qi); '\n'); mysql_store_result(conn if
cout << "Enter ); (storeUserTripPlan2d[i]
if (!qstate) User Name (X to not [j] == userTripPlanId)
{ change): "; {
printf("---------------------
cout << endl; getline(cin,
------------------------------
userName);
------\n"); userTripPlan =
res = if (userName ==
printf("| %-10s storeUserTripPlan2d[i]
mysql_store_result(conn "X")
| %-40s |\n", "Trip Id", [k];
); {
"Trip Name"); break;
while ((row = userName =
while ((row = }
mysql_fetch_row(res))) storeUserName;
mysql_fetch_row(res))) }
{ }
{ }
cout << cout << "Enter
printf("| %-
"User Name: " << User Address (X to not
10s | %-40s |\n", row[0], cout << "Enter
row[1] << "\nUser change): ";
row[1]); Trip Cost (X to not
Address: " << row[2] << getline(cin,
change): ";
"\nUser Phone: " << userAddress);
storeUserTripPlan2d[sto getline(cin,
row[3] << "\nUser if (userAddress
reIndex1][storeIndex2] userTripCost);
Email: " << row[4] << == "X")
= row[0]; if (userTripCost
"\nTrip Date: " << {
== "X")
row[5] << "\nTrip Plan: userAddress =
storeIndex2++; {
" << row[6] << "\nTrip storeUserAddress;
userTripCost
Cost: " << row[7] << }
= storeUserTripCost;
endl << endl; cout << "Enter storeUserTripPlan2d[sto
}
User Phone No. (X to reIndex1][storeIndex2]
not change): "; = row[1];
storeColumnId = string
getline(cin,
row[0]; update_query = "update
userPhone); storeIndex1+ travelagency_tb set
if (userPhone == +;storeIndex2--;
storeUserName = t_username =
"X") }
row[1]; '"+userName+"',
{
t_useraddress =
userPhone = printf("---------------------
storeUserAddress = '"+userAddress+"',
storeUserPhone; ------------------------------
row[2]; t_userphone =
} ------\n"); '"+userPhone+"',
cout << "Enter } t_useremail =
storeUserPhone = User Email (X to not else '"+userEmail+"',
row[3]; change): "; { t_usertripdate =
getline(cin,
'"+userTripDate+"',
userEmail);

16 | P a g e
t_usertripplan = int indexForId = 0; cout << endl; cout <<
'"+userTripPlan+"', bool HaveException cout << "Enter "Failed To Delete!" <<
t_usertripcost = = false, NotInDatabase Item Column ID: "; mysql_errno(conn) <<
'"+userTripCost+"' = false; cin >> itemId; endl;
where t_id = // Variables End cout << endl; }
'"+strid+"'"; }
const char* qu = cout << "Welcome To catch (exception e) }
update_query.c_str(); Travel Agency { else
qstate = Management System" cout << "Please {
mysql_query(conn, qu); << endl << endl; Enter a valid cout << "Item
cout << "Show Users NUMBER." << endl; Not Found in database."
if (!qstate) Menu" << endl << endl; HaveException = << endl;
{ true; }
cout << endl goto ExitMenu; }
<< "Successfully Saved qstate = }
In Database." << endl; mysql_query(conn, // Exit Code
} "select * from if (HaveException == ExitMenu:
else travelagency_tb"); false) cout << "Press 'm' to
{ if (!qstate) { Menu, 'd' to delete
cout << { stringstream another record and any
"Failed To Update!" << res = streamid; other key to Exit: ";
mysql_errno(conn) << mysql_store_result(conn string strid; cin >> choose;
endl; ); streamid << itemId; if (choose == 'm' ||
} streamid >> strid; choose == 'M')
printf("--------------------- {
} ------------------------------ for (int i = 0; i < main();
else ------------------------------ indexForId; i++) }
{ ------------------------------ { else if (choose == 'd' ||
cout << "Item --\n"); if (strid != choose == 'D')
Not Found in database." printf("| %-10s | %- items[i]) {
<< endl; 25s | %-25s | %-40s |\n", { DeleteUser();
} "Column ID", "User NotInDatabase }
} Name", "Trip Date", = true; else
"Trip Plan"); }else {
ExitMenu: while ((row = { exit(0);
cout << "Press 'm' to mysql_fetch_row(res))) NotInDatabase }
Menu, 'e' to edit another { = false; }
item and any other key printf("| %-10s | break;
to Exit: "; %-25s | %-25s | %-40s } void AddTrip()
cin >> choose; |\n", row[0], row[1], } {
if (choose == 'm' || row[5], row[6]); // Initial Load
choose == 'M') if (NotInDatabase system("cls");
{ items[indexForId] = == false) // Initial Load End
main(); row[0]; {
} indexForId++; string // Variables
else if (choose == 'e' || } delete_query = "delete string tripName = "";
choose == 'E') from travelagency_tb char choose;
{ where t_id = // Variables End
printf("---------------------
EditUser(); '"+strid+"'";
------------------------------
} const char* qd = cout << "Welcome To
------------------------------
else delete_query.c_str(); Travel Agency
------------------------------
{ qstate = Management System"
--\n");
exit(0); mysql_query(conn, qd); << endl << endl;
}
} cout << "Add Trip
else
} if (!qstate) Menu" << endl << endl;
{
{
cout << "Query
void DeleteUser() cout << cin.ignore(1, '\n');
Execution Problem!" <<
{ "Successfully Deleted cout << "Enter Trip
mysql_errno(conn) <<
system("cls"); From Database." << Name: ";
endl;
endl; getline(cin,
}
// Variables } tripName);
char choose; else
try
int itemId; { string insert_query =
{
string items[5000]; "insert into
17 | P a g e
travelagencytrips_tb // Exit Code ------------------------------ NotInDatabase
(t_trip) values cout << "Press 'm' to ------\n"); = false;
('"+tripName+"')"; Menu and 'a' to Insert printf("| %-10s | %- break;
Again Or Any Other key 40s |\n", "Trip Id", "Trip }
const char* q = to exit: "; Name"); }
insert_query.c_str(); // cin >> choose; while ((row =
c_str converts string to if (choose == 'm' || mysql_fetch_row(res))) if (NotInDatabase
constant char and this is choose == 'M') { == false)
required { printf("| %-10s | {
main(); %-40s |\n", row[0], string
qstate = } row[1]); findbyid_query = "select
mysql_query(conn, q); else if (choose == 'a' || } * from
choose == 'A') travelagencytrips_tb
if (!qstate) { printf("--------------------- where t_id =
{ AddTrip(); ------------------------------ '"+strid+"'";
cout << endl << } ------\n"); const char* qi =
"Successfully added in else } findbyid_query.c_str();
database." << endl; { else qstate =
} exit(0); { mysql_query(conn, qi);
else } cout << "Query
{ } Execution Problem!" << if (!qstate)
cout << "Query mysql_errno(conn) << {
Execution Problem!" << void EditTrip() endl; cout << endl;
mysql_errno(conn) << { } res =
endl; system("cls"); mysql_store_result(conn
} try );
// Variables {
qstate = string tripName = ""; cout << endl; printf("---------------------
mysql_query(conn, string items[5000]; cout << "Enter ------------------------------
"select * from char choose; Item Column ID: "; ------\n");
travelagencytrips_tb"); int itemId; cin >> itemId; printf("| %-10s
if (!qstate) bool HaveException cout << endl; | %-40s |\n", "Trip Id",
{ = false; } "Trip Name");
res = bool NotInDatabase = catch (exception e) while ((row =
mysql_store_result(conn false; { mysql_fetch_row(res)))
); int indexForId = 0; cout << "Please {
Enter a valid printf("| %-
printf("--------------------- // Store Variables NUMBER." << endl; 10s | %-40s |\n", row[0],
------------------------------ string storeColumnId HaveException = row[1]);
------\n"); = ""; true; }
printf("| %-10s | %- string storeTripName goto ExitMenu;
40s |\n", "Trip Id", "Trip = ""; } printf("---------------------
Name"); // Variables End ------------------------------
while ((row = if (HaveException == ------\n");
mysql_fetch_row(res))) cout << "Welcome To false) }
{ Student Fee Inquiry { else
printf("| %-10s | Program" << endl << stringstream {
%-40s |\n", row[0], endl; streamid; cout <<
row[1]); cout << "Edit Trip string strid; "Query Execution
} Record" << endl; streamid << itemId; Problem!" <<
streamid >> strid; mysql_errno(conn) <<
printf("--------------------- endl;
------------------------------ qstate = for (int i = 0; i < }
------\n"); mysql_query(conn, indexForId; i++)
} "select * from { cin.ignore(1,
else travelagencytrips_tb"); if (strid != '\n');
{ if (!qstate) items[i]) cout << "Enter
cout << "Query { { Trip Name (xN to not
Execution Problem!" << res = NotInDatabase change): ";
mysql_errno(conn) << mysql_store_result(conn = true; getline(cin,
endl; ); }else tripName);
} { if (tripName ==
printf("--------------------- "xN")

18 | P a g e
{ cout << "Enter cout <<
tripName = // Variables Item Column ID: "; "Failed To Delete!" <<
storeTripName; char choose; cin >> itemId; mysql_errno(conn) <<
} int itemId; cout << endl; endl;
string items[5000]; } }
string int indexForId = 0; catch (exception e)
update_query = "update bool HaveException { }
travelagencytrips_tb set = false, NotInDatabase cout << "Please else
t_trip = '"+tripName+"' = false; Enter a valid {
where t_id = // Variables End NUMBER." << endl; cout << "Item
'"+strid+"'"; HaveException = Not Found in database."
const char* qu = cout << "Welcome To true; << endl;
update_query.c_str(); Travel Agency goto ExitMenu; }
qstate = Management System" } }
mysql_query(conn, qu); << endl << endl; //Project By
cout << "Delete User if (HaveException == CodeWithC.com
if (!qstate) Menu" << endl << endl; false) // Exit Code
{ { ExitMenu:
cout << endl stringstream cout << "Press 'm' to
<< "Successfully Saved qstate = streamid; Menu, 'd' to delete
In Database." << endl; mysql_query(conn, string strid; another record and any
} "select * from streamid << itemId; other key to Exit: ";
else travelagencytrips_tb"); streamid >> strid; cin >> choose;
{ if (!qstate) if (choose == 'm' ||
cout << { for (int i = 0; i < choose == 'M')
"Failed To Update!" << res = indexForId; i++) {
mysql_errno(conn) << mysql_store_result(conn { main();
endl; ); if (strid != }
} items[i]) else if (choose == 'd' ||
printf("--------------------- { choose == 'D')
} ------------------------------ NotInDatabase {
else ------\n"); = true; DeleteUser();
{ printf("| %-10s | %- }else }
cout << "Item 40s |\n", "Trip ID", "Trip { else
Not Found in database." Name"); NotInDatabase {
<< endl; while ((row = = false; exit(0);
} mysql_fetch_row(res))) break; }
} { } }
printf("| %-10s | }
ExitMenu: %-40s |\n", row[0],
cout << "Press 'm' to row[1]); if (NotInDatabase
Menu, 'e' to edit another == false)
item and any other key items[indexForId] = {
to Exit: "; row[0]; string
cin >> choose; indexForId++; delete_query = "delete
if (choose == 'm' || } from
choose == 'M') travelagencytrips_tb
{ where t_id =
printf("---------------------
main(); '"+strid+"'";
------------------------------
} const char* qd =
------\n");
else if (choose == 'e' || delete_query.c_str();
}
choose == 'E') qstate =
else
{ mysql_query(conn, qd);
{
EditTrip();
cout << "Query
} if (!qstate)
Execution Problem!" <<
else {
mysql_errno(conn) <<
{ cout <<
endl;
exit(0); "Successfully Deleted
}
} From Database." <<
} endl;
try
}
{
void DeleteTrip() else
cout << endl;
{ {
system("cls");
19 | P a g e

You might also like