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

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

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

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

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

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

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

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

1|P a g e
TRAVELING AGENGY

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.

2|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.

3|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.

4|P a g e
Hardware requirements:

Minimum requirements of 64 MB RAM.

Software requirements:

Turbo C

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 :

5|P a g e
Total cost of travels=((per km+Temporary
pervana(TP))*(total km))

2) travels of white board:Total cost of travels =(per km*total km)

Output:

1)REGISTRATION.

2)DISPLAY

6|P a g e
3)SERACH

4)MODIFY

7|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 .

2.#include<conio.h>

8|P a g e
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.

 Constant, data type and global variable are used for some comparisons
of character, check length for character.

5.#include<ctype.h>

9|P a g e
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().

10 | 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.

11 | P a g e
Code:

{ char exitSurity; DeleteUser();


#include<iostream> cout << // Variables End break;
#include<cstdio> "Database Connected To case 6:
#include<fstream> MySql" << conn << endl; cout << "Welcome To AddTrip();
#include<sstream> cout << "Press Travel Agency break;
#include<string> any key to continue..." Management System" case 7:
#include<cstdlib> << endl; << endl << endl; EditTrip();
#include<conio.h> //getch(); cout << "Travel break;
#include<windows.h> system("cls"); Agency Management case 8:
#include<mysql.h> } Menu" << endl; DeleteTrip();
using namespace std; else cout << "1. New break;
cout << "Failed To Travel Trip." << endl; case 9:
// Global Variable Connect!" << cout << "2. Show ExitProgram:
int qstate; mysql_errno(conn) << Users." << endl; cout << "Program
MYSQL* conn; endl; cout << "3. Find User." terminating. Are you
MYSQL_ROW row; } << endl; sure? (y/N): ";
MYSQL_RES* res; }; cout << "4. Edit User." cin >> exitSurity;
// Global Variable End << endl; if (exitSurity == 'y'
// Functions cout << "5. Delete || exitSurity == 'Y') {
class db_response void NewTravelTrip(); User." << endl; return 0;
{ void ShowUsers(); cout << "6. Add Trip." }else if (exitSurity ==
public: void FindUser(); << endl; 'n' || exitSurity == 'N') {
static void void EditUser(); cout << "7. Edit Trip." system("cls");
ConnectionFunction() void DeleteUser(); << endl; main();
{ void AddTrip(); cout << "8. Delete }else {
conn = void EditTrip(); Trip." << endl; cout << "Next
mysql_init(0); void DeleteTrip(); cout << "9. Exit." << time choose after read
if (conn) // Functions End endl; the corresponding line."
{ cout << "Choose One: << endl;
cout << int main() "; goto ExitProgram;
"Database Connected" { cin >> }
<< endl; // Initial Load chooseOneFromMenu; break;
cout << "Press system("cls"); default:
any key to continue..." system("title Travel switch cout << "Please
<< endl; Agency Management (chooseOneFromMenu) choose between 1 - 7.
//getch(); System Program"); { Press Enter To
system("cls"); system("color 0f"); case 1: Continue...";
} // Initial Load End NewTravelTrip(); getch();
else break; system("cls");
cout << "Failed To // Call Methods case 2: main();
Connect!" << ShowUsers(); break;
mysql_errno(conn) << db_response::Connectio break; }
endl; nFunction(); case 3: return 0;
conn = // Call Methods End FindUser(); }
mysql_real_connect(con break; //Project By
n, "localhost", "root", "", // Variables case 4: CodeWithC.com
"cpp_travelagency_db", int EditUser(); // Functions
0, NULL, 0); chooseOneFromMenu = break; void NewTravelTrip()
if (conn) 0; case 5: {

12 | P a g e
// Initial Load "select * from cout << "Enter Trip }
system("cls"); travelagencytrips_tb"); Cost: "; else
// Initial Load End if (!qstate) getline(cin, {
{ userTripCost); exit(0);
// Variables res = }
string userName = ""; mysql_store_result(con string insert_query =
string userAddress = n); "insert into }
""; printf("----------------- travelagency_tb
string userPhone = ""; -------------------------------- (t_username, void ShowUsers()
string userEmail = ""; --------\n"); t_useraddress, {
string userTripDate = printf("| %-10s | %- t_userphone, // Initial Load
""; 40s |\n", "Trip Id", "Trip t_useremail, system("cls");
string userTripPlanId = Name"); t_usertripdate, // Initial Load End
""; while ((row = t_usertripplan,
string userTripPlan = mysql_fetch_row(res))) t_usertripcost) values // Variables
""; { ('"+userName+"','"+user char choose;
string userTripCost = printf("| %-10s | Address+"','"+userPhone // Variables End
""; %-40s |\n", row[0], +"','"+userEmail+"','"+us
char choose; row[1]); erTripDate+"','"+userTri cout << "Welcome To
// Variables End pPlan+"','"+userTripCost Travel Agency
storeUserTripPlan[storeI +"')"; Management System"
// Store Variables ndex1][storeIndex2] = << endl << endl;
string row[0]; const char* q = cout << "Show Users
storeUserTripPlan[500][ storeIndex2++; insert_query.c_str(); // Menu" << endl << endl;
500]; c_str converts string to
int storeIndex1 = 0, storeUserTripPlan[storeI constant char and this is qstate =
storeIndex2 = 0; ndex1][storeIndex2] = required mysql_query(conn,
// Store Variables End row[1]; "select * from
qstate = travelagency_tb");
cout << "Welcome To storeIndex1++;storeInde mysql_query(conn, q); if (!qstate)
Travel Agency x2--; {
Management System" } if (!qstate) res =
<< endl << endl; printf("----------------- { mysql_store_result(con
cout << "New Travel -------------------------------- cout << endl << n);
Trip Menu" << endl << --------\n"); "Successfully added in while ((row =
endl; } database." << endl; mysql_fetch_row(res)))
else } {
cin.ignore(1, '\n'); { else cout << "User
cout << "Enter User cout << "Query { Name: " << row[1] <<
Name: "; Execution Problem!" << cout << "Query "\nUser Address: " <<
getline(cin, mysql_errno(conn) << Execution Problem!" << row[2] << "\nUser
userName); endl; mysql_errno(conn) << Phone: " << row[3] <<
cout << "Enter User } endl; "\nUser Email: " <<
Address: "; cout << "Enter Trip Id: } row[4] << "\nTrip Date: "
getline(cin, "; << row[5] << "\nTrip
userAddress); getline(cin, // Exit Code Plan: " << row[6] <<
cout << "Enter Phone userTripPlanId); cout << "Press 'm' to "\nTrip Cost: " << row[7]
No.: "; for (int i = 0, j = 0, k = Menu and 'a' to Insert << endl << endl;
getline(cin, 1; i < storeIndex1; i++) Again Or Any Other key }
userPhone); { to exit: "; }
cout << "Enter Email: if cin >> choose; else
"; (storeUserTripPlan[i][j] if (choose == 'm' || {
getline(cin, == userTripPlanId) choose == 'M') cout << "Query
userEmail); { { Execution Problem!" <<
cout << "Enter Trip userTripPlan = main(); mysql_errno(conn) <<
Date: "; storeUserTripPlan[i][k]; } endl;
getline(cin, break; else if (choose == 'a' }
userTripDate); } || choose == 'A')
qstate = } { // Exit Code
mysql_query(conn, NewTravelTrip(); ExitMenu:

13 | P a g e
cout << "Press 'm' to "\nUser Address: " << char choose; Name", "Trip Date",
Menu and any other key row[2] << "\nUser int itemId; "Trip Plan");
to Exit: "; Phone: " << row[3] << bool HaveException = while ((row =
cin >> choose; "\nUser Email: " << false; mysql_fetch_row(res)))
if (choose == 'm' || row[4] << "\nTrip Date: " bool NotInDatabase = {
choose == 'M') << row[5] << "\nTrip false; printf("| %-10s |
{ Plan: " << row[6] << int indexForId = 0; %-25s | %-25s | %-40s
main(); "\nTrip Cost: " << row[7] |\n", row[0], row[1],
} << endl << endl; // Store Variables row[5], row[6]);
else } string storeColumnId }
{ } = ""; printf("-----------------
exit(0); else string storeUserName --------------------------------
} { = ""; --------------------------------
} cout << "Query string --------------------------------
Execution Problem!" << storeUserAddress = ""; \n");
void FindUser() mysql_errno(conn) << string storeUserPhone }
{ endl; = ""; else
// Initial Load } string storeUserEmail {
system("cls"); = ""; cout << "Query
// Initial Load End ExitMenu: string Execution Problem!" <<
cout << "Press 'm' to storeUserTripDate = ""; mysql_errno(conn) <<
// Variables Menu, 'a' to Search string endl;
string input = ""; again and any other key storeUserTripPlanId = ""; }
char choose; to Exit: "; string
// Variables End cin >> choose; storeUserTripPlan = ""; try
if (choose == 'm' || string {
cout << "Welcome To choose == 'M') storeUserTripCost = ""; cout << endl;
Travel Agency { string cout << "Enter Item
Management System" main(); storeUserTripPlan2d[50 Column ID: ";
<< endl << endl; } 0][500]; cin >> itemId;
cout << "Show Users else if (choose == 'a' int storeIndex1 = 0, cout << endl;
Menu" << endl << endl; || choose == 'A') storeIndex2 = 0; }
{ // Variables End catch (exception e)
cin.ignore(1, '\n'); FindUser(); {
cout << "Enter User } cout << "Welcome To cout << "Please
Name: "; else Student Fee Inquiry Enter a valid NUMBER."
getline(cin, input); { Program" << endl << << endl;
string exit(0); endl; HaveException =
findbyname_query = } cout << "Edit Student true;
"select * from } Record" << endl; goto ExitMenu;
travelagency_tb where }
t_username like void EditUser()
'%"+input+"%'"; { qstate = if (HaveException ==
const char* qn = system("cls"); mysql_query(conn, false)
findbyname_query.c_str "select * from {
(); // Variables travelagency_tb"); stringstream
qstate = string userName = ""; if (!qstate) streamid;
mysql_query(conn, qn); string userAddress = { string strid;
""; res = streamid << itemId;
cout << endl; string userPhone = ""; mysql_store_result(con streamid >> strid;
if (!qstate) string userEmail = ""; n);
{ string userTripDate = printf("----------------- for (int i = 0; i <
res = ""; -------------------------------- indexForId; i++)
mysql_store_result(con string userTripPlanId = -------------------------------- {
n); ""; -------------------------------- if (strid !=
while ((row = string userTripPlan = \n"); items[i])
mysql_fetch_row(res))) ""; printf("| %-10s | %- {
{ string userTripCost = 25s | %-25s | %-40s NotInDatabase
cout << "User ""; |\n", "Column ID", "User = true;
Name: " << row[1] << string items[5000]; }else

14 | P a g e
{ cout << "Enter cout << "Enter
NotInDatabase storeUserTripCost = User Trip Date (X to not Trip Id (X to not change):
= false; row[7]; change): "; ";
break; } cin >> getline(cin,
} } userTripDate; userTripPlanId);
} else if (userTripDate if (userTripPlanId
{ == "X") == "X")
if (NotInDatabase cout << "Query { {
== false) Execution Problem!" << userTripDate = userTripPlan =
{ mysql_errno(conn) << storeUserTripDate; storeUserTripPlan;
string endl; } }
findbyid_query = "select } else
* from travelagency_tb qstate = {
where t_id = '"+strid+"'"; cin.ignore(1, '\n'); mysql_query(conn, for (int i = 0, j =
const char* qi = cout << "Enter "select * from 0, k = 1; i < storeIndex1;
findbyid_query.c_str(); User Name (X to not travelagencytrips_tb"); i++)
qstate = change): "; if (!qstate) {
mysql_query(conn, qi); getline(cin, { if
userName); res = (storeUserTripPlan2d[i][j
if (!qstate) if (userName == mysql_store_result(con ] == userTripPlanId)
{ "X") n); {
cout << endl; { printf("-----------
userName = -------------------------------- userTripPlan =
res = storeUserName; --------------\n"); storeUserTripPlan2d[i][k
mysql_store_result(con } printf("| %-10s ];
n); cout << "Enter | %-40s |\n", "Trip Id", break;
while ((row = User Address (X to not "Trip Name"); }
mysql_fetch_row(res))) change): "; while ((row = }
{ getline(cin, mysql_fetch_row(res))) }
cout << userAddress); {
"User Name: " << row[1] if (userAddress == printf("| %- cout << "Enter
<< "\nUser Address: " << "X") 10s | %-40s |\n", Trip Cost (X to not
row[2] << "\nUser { row[0], row[1]); change): ";
Phone: " << row[3] << userAddress = getline(cin,
"\nUser Email: " << storeUserAddress; storeUserTripPlan2d[sto userTripCost);
row[4] << "\nTrip Date: " } reIndex1][storeIndex2] = if (userTripCost
<< row[5] << "\nTrip cout << "Enter row[0]; == "X")
Plan: " << row[6] << User Phone No. (X to not {
"\nTrip Cost: " << row[7] change): "; storeIndex2++; userTripCost =
<< endl << endl; getline(cin, storeUserTripCost;
userPhone); storeUserTripPlan2d[sto }
storeColumnId = row[0]; if (userPhone == reIndex1][storeIndex2] =
"X") row[1]; string
storeUserName = { update_query = "update
row[1]; userPhone = storeIndex1++;storeInde travelagency_tb set
storeUserPhone; x2--; t_username =
storeUserAddress = } } '"+userName+"',
row[2]; cout << "Enter printf("----------- t_useraddress =
User Email (X to not -------------------------------- '"+userAddress+"',
storeUserPhone = change): "; --------------\n"); t_userphone =
row[3]; getline(cin, } '"+userPhone+"',
userEmail); else t_useremail =
storeUserEmail = if (userEmail == { '"+userEmail+"',
row[4]; "X") cout << "Query t_usertripdate =
{ Execution Problem!" << '"+userTripDate+"',
storeUserTripDate = userEmail = mysql_errno(conn) << t_usertripplan =
row[5]; storeUserEmail; endl; '"+userTripPlan+"',
} } t_usertripcost =
storeUserTripPlan = cin.ignore(1, '\n'); '"+userTripCost+"'
row[6]; where t_id = '"+strid+"'";

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

16 | P a g e
getline(cin, tripName); cout << "Query "select * from for (int i = 0; i <
Execution Problem!" << travelagencytrips_tb"); indexForId; i++)
string insert_query = mysql_errno(conn) << if (!qstate) {
"insert into endl; { if (strid !=
travelagencytrips_tb } res = items[i])
(t_trip) values mysql_store_result(con {
('"+tripName+"')"; // Exit Code n); NotInDatabase
cout << "Press 'm' to printf("----------------- = true;
const char* q = Menu and 'a' to Insert -------------------------------- }else
insert_query.c_str(); // Again Or Any Other key --------\n"); {
c_str converts string to to exit: "; printf("| %-10s | %- NotInDatabase
constant char and this is cin >> choose; 40s |\n", "Trip Id", "Trip = false;
required if (choose == 'm' || Name"); break;
choose == 'M') while ((row = }
qstate = { mysql_fetch_row(res))) }
mysql_query(conn, q); main(); {
} printf("| %-10s | if (NotInDatabase
if (!qstate) else if (choose == 'a' %-40s |\n", row[0], == false)
{ || choose == 'A') row[1]); {
cout << endl << { } string
"Successfully added in AddTrip(); printf("----------------- findbyid_query = "select
database." << endl; } -------------------------------- * from
} else --------\n"); travelagencytrips_tb
else { } where t_id = '"+strid+"'";
{ exit(0); else const char* qi =
cout << "Query } { findbyid_query.c_str();
Execution Problem!" << } cout << "Query qstate =
mysql_errno(conn) << Execution Problem!" << mysql_query(conn, qi);
endl; void EditTrip() mysql_errno(conn) <<
} { endl; if (!qstate)
system("cls"); } {
qstate = cout << endl;
mysql_query(conn, // Variables try res =
"select * from string tripName = ""; { mysql_store_result(con
travelagencytrips_tb"); string items[5000]; cout << endl; n);
if (!qstate) char choose; cout << "Enter Item printf("-----------
{ int itemId; Column ID: "; --------------------------------
res = bool HaveException = cin >> itemId; --------------\n");
mysql_store_result(con false; cout << endl; printf("| %-10s
n); bool NotInDatabase = } | %-40s |\n", "Trip Id",
printf("----------------- false; catch (exception e) "Trip Name");
-------------------------------- int indexForId = 0; { while ((row =
--------\n"); cout << "Please mysql_fetch_row(res)))
printf("| %-10s | %- // Store Variables Enter a valid NUMBER." {
40s |\n", "Trip Id", "Trip string storeColumnId << endl; printf("| %-
Name"); = ""; HaveException = 10s | %-40s |\n",
while ((row = string storeTripName true; row[0], row[1]);
mysql_fetch_row(res))) = ""; goto ExitMenu; }
{ // Variables End } printf("-----------
printf("| %-10s | --------------------------------
%-40s |\n", row[0], cout << "Welcome To if (HaveException == --------------\n");
row[1]); Student Fee Inquiry false) }
} Program" << endl << { else
printf("----------------- endl; stringstream {
-------------------------------- cout << "Edit Trip streamid; cout << "Query
--------\n"); Record" << endl; string strid; Execution Problem!" <<
} streamid << itemId; mysql_errno(conn) <<
else streamid >> strid; endl;
{ qstate = }
mysql_query(conn,

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

18 | P a g e

You might also like