Posted by MindBreaker at 8:39 AM
Read our previous post
TAXI RESERVATION SYSTEM DESIGN BY FAIZAN ALI
EHISHAM-UL-HAQ
ATHAR FAROOQ
SOURCE CODE:
#include <iostream>
#include <conio.h>
#include <string>
#include <stdio.h>
#include <fstream>
using namespace std;
void main()
{
do{char select ;
cout<<"\t\t\t TAXI RESERVATION SYSTEM"<<endl;
cout<<"\tPress '1' for Taxi Reservation"<<endl;
cout<<"\tPress '2' for Management"<<endl;
cin>>select;
switch (select)
{
case '1':
{
//col row
char cars[10][10]={"ALTO",
"MEHRAN",
"CULTUS",
"CITY",
"BELINO",
"HONDA",
"CAROLA",
"MERCEDES",
"MERGALLA",
"LIANA"};
char location[13][15]={
"Nazimabab",
"North Karachi ",
"Gulshan",
"Defence",
"Tower",
"Tariq Road",
"Clifton",
"Airport",
"Liyari",
"Malire",
"Steel Town",
"Saddar",
"Johour"};
double prices[10][13]={
{20,30,40,50,60,70,80,70,50,40,30,20,10},
{10,1.28,1.38,1.48,1.58,1.68,1.78,1.88,1.98,2.08,2.20,2.30,2.40},
{20,1.32,1.42,1.52,1.62,1.72,1.82,1.92,2.02,2.15,2.25,2.35,2.45},
{30,1.45,1.52,1.63,1.74,1.85,1.96,2.09,2.18,2.32,2.45,2.56,2.78},
{40,1.54,1.65,1.74,1.83,1.92,2.09,2.18,2.28,2.42,2.65,2.76,2.88},
{50,1.67,1.78,1.87,1.98,2.18,2.20,2.32,2.45,2.56,2.69,2.78,2.95},
{60,1.78,1.87,1.99,2.10,2.30,2.45,2.55,2.65,2.72,2.82,2.98,3.01},
{70,1.82,1.92,2.09,2.18,2.29,2.32,2.45,2.56,2.67,2.87,2.97,3.09},
{80,1.98,2.08,2.19,2.36,2.56,2.76,2.89,3.12,3.26,3.40,3.55,3.67},
{90,2.09,2.18,2.32,2.45,2.78,2.98,3.18,3.36,3.67,3.89,4.09,4.25}
};
double prices2[13][13]={
{10,30,20,40,50,60,70,20,20,10,20,30,20},
{48,28,38,48,58,68,78,88,98,120,140,160,180},
{40,32,42,52,62,72,82,92,120,140,160,180,245},
{50,45,52,63,74,85,96,100,140,160,180,200,278},
{60,54,65,74,83,92,100,120,160,180,200,225,276},
{70,67,78,87,98,100,120,140,180,200,220,256,295},
{80,78,87,99,100,120,140,160,200,220,240,275,298},
{90,82,92,100,120,140.160,180,225,256,260,295,297,309},
{30,98,98,120,150,160,180,200,250,300,300,340,355},
{40,100,180,195,210,245,287,300,315,345,367,498,550},
{50,120,200,225,245,256,287,310,325,365,378,390,410},
{60,140,240,280,320,340,380,340,360,380,420,440,480},
{70,160,260,310,330,370,390,410,450,465,496,500,550},
};
system ("CLS");
int model[13]={2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012};
int vechicle[10],date;
char year[5],nic[20],
pick[15],
destination[15],
shift[10],
ampm,
mod[5],day[10],
car[10];
char name[50],
PM,
AM;
int hour1,hour,
minutes,
serial,
serial1,
serial2,
serial3;
double total;
cout<<"\t\t WELCOME to TAXI RESERVATION SYSTEM"<<endl;
//take personal infomation form user
cout<<"Enter Your name"<<endl;
fflush(stdin);
cin.getline(name, 50);
cout<<"Enter your NATIONAL IDENTITY CARD NUMBER (NIC)"<<endl;
cin>>nic;
cout<<endl;
cout<<"Enter your PLACE TO PICK "<<endl;
cout<<endl;
for (int row=0;row<13;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<location[row][col]<<" ";
}
cout<<endl;
}
cout<<"Place name"<<endl;
fflush(stdin);
cin.getline(pick,15);
cout<<"Serial"<<endl;
cin>>serial2;
cout<<endl;
cout<<"Enter your DESTINATION"<<endl;
cout<<endl;
for (int row=0;row<13;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<location[row][col]<<" ";
}
cout<<endl;
}
fflush(stdin);
cin.getline(destination,15);
cout<<endl;
cout<<"Serial"<<endl;
cin>>serial3;
cout<<endl;
cout<<"Enter your timing hours"<<endl;
cin>>hour1;
cout<<endl;
//timing shift
do{
cout<<"Please Enter time in format of 12 or 24"<<endl;
cin>>hour;
if(hour > 23)
cout<<"Enter hour value between 0 and 23";
}
while (hour>23);
do{
cout<<"Please enter minute"<<endl;
cin>>minutes;
if(minutes>59)
cout<<"Enter minute value between 0 and 59";
}
while (minutes>59);
if(hour>12)
{
hour=hour-12;
ampm='P';
cout<<"Evening Shift ";
}
else if(hour==12)
{
ampm='P';
cout<<"Evening Shift ";
}
else
{
ampm='A';
cout<<"Morning Shift ";
}
cout<<"Date of Reservation"<<endl;
cin>>date;
cout<<"Day of Reservation"<<endl;
fflush(stdin);
cin.getline(day,10);
cout<<"Year of reservation"<<endl;
fflush(stdin);
cin.getline(year,5);
cout<<"Enter serial no of selected CAR "<<endl;
for (int row=0;row<10;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<cars[row][col]<<" ";
}
cout<<endl;
}
cin>>car;// select what car do user want
cout<<"Serial"<<endl;
cin>>serial;
cout<<"Please select model for CAR and serial number"<<endl;
for( int digit=0;digit<13;digit++)
{
cout<<digit+1<<" "<<"-"<<model[digit]<<endl;
}
cout<<endl;
cin>>mod;
cout<<endl;
cout<<"Serial"<<endl;
cin>>serial1;
system("cls");
cout<<"\t\t\t Passenger Information"<<endl;
cout<<endl;
for(int num=0;num<8;num++)
{cout<<"\t\t\t";
for(int row=0;row<4;row++)
{
for(int col=0;col<4;col++)
{
cout<<"*";
}
cout<<" - ";
}
cout<<endl;
}
cout<<endl;
total=(serial1*prices2[serial2][serial3])+99;
///////////////////////////////////////////output of all the input information//////////////////////////////////////////////////////////
cout<<"\t\t\t Passenger Name : "<<name<<endl;
cout<<"\t\t\t Passenger NIC No : "<<nic<<endl;
cout<<"\t\t\t Pick Up Point : "<<pick<<endl;
cout<<"\t\t\t Destination : "<<destination<<endl;
cout<<"\t\t\t Selected Car : "<<car<<endl;
cout<<"\t\t\t Vechicle Model : "<<mod<<endl;
cout<<"\t\t\t The Time is "<<hour<<":"<<minutes<<ampm<<" M "<<endl;
cout<<"\t\t\t Date is "<< date<<"/"<<day<<"/"<<year<<endl;
cout<<"\t\t\t Total Payment = "<<total<<endl;
//RECTAGULAR
//////////////////////////////////////// filling start here for routine////////////////////////////////////////////////////////////////
ofstream myfile;
myfile.open("routine.txt",ios::app);
myfile<<"Passenger Name: " <<name <<endl;
myfile<<"Passenger NIC no: "<<nic<<endl;
myfile<<"Pick Up piont: "<<pick<<endl;
myfile<<"Destination"<<destination<<endl;
myfile<<"Selected Car "<<car<<endl;
myfile<<"Vehicle Model"<<mod<<endl;
myfile<<"The Time is "<<hour<<":"<<minutes<<ampm<<" M "<<endl;
myfile<<"\t\t\t Date is "<< date<<"/"<<day<<"/"<<year<<endl;
myfile<<"Total Payment "<<endl;
system ("pause");
break;
}
case '2':
{
struct driver
{
char name[50];
int age;
char address[50];
int lience[6];
char type[5];
};
struct vehicles
{
char car[10];
int model;
char plate[10];
char carlience[10];
char color[10];
};
struct mtain
{
char month[10];
char miantaince[5];
char petrol[5];
char totalmonthlydrvpay[15];
char totalcompanyprofit[15];
char totalincome[15];
};
char option;
cout<<"\t\t\tWELCOME TO TAXI MANAGEMENT"<<endl;
cout<<"\t* PRESS 1 for drivers information management"<<endl;
cout<<"\t* PRESS 2 for car inquiry"<<endl;
cout<<"\t* PRESS 3 for Routine and messenger management"<<endl;
cout<<"\t* PRESS 4 for Income generating management"<<endl;
cout<<"\t* PRESS 5 for vehicles maintenance management. "<<endl;
cin>>option;
system ("cls");
switch(option)
{
{
case '1':
{
char opt;//option to select
cout<<"DRIVER INFORMATION MANAGEMENT"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>opt;
switch(opt)
{
case '1':
{///////////////////////////////// to write new file///////////////////////////////////////////////////////
driver drv[150];
char name[50],adress[50],type[5];
int age,lience[6],drivers=150;
cout<<"Enetr Data of 150 drivers"<<endl;
for(int count=0;count<drivers;count++)
{
cout<<"Enter driver name"<<endl;
fflush(stdin);
cin.getline(drv[count].name,50);
cout<<"Enter driver age"<<endl;
cin>>drv[count].age;
cout<<"Enter driver address"<<endl;
fflush(stdin);
cin.getline(drv[count].address,50);
cout<<"Enter driver lience"<<endl;
cin>>drv[count].lience[6];
cout<<"Enter driver lience type"<<endl;
fflush(stdin);
cin.getline(drv[count].type,5);
// writting in file start here
ofstream file;
file.open("driver.txt",ios::app);
file<<drv[count].name<<endl;
file<<drv[count].age<<endl;
file<<drv[count].address<<endl;
file<<drv[count].lience<<endl;
file<<drv[count].type<<endl;
file.close();
}
break;
}
case '2':
{
/////////////////////////////// read the file/////////////////////////////////////////////////////////
ifstream file;
file.open("drivers.txt");
string retrieve;
if(file)
{
while(getline(file, retrieve))
{
cout<<retrieve<<endl;
}
}
file.close();
break;
}
case '3':
{
// //////////////////////////////Edit the file ////////////////////////////////////////////////////////
driver drv[150];
char name[50],adress[50],type[5];
int age,lience[6],drivers;
cout<<"NO of drivers maximum 150"<<endl;
cin>>drivers;
for(int count=0;count<drivers;count++)
{
cout<<"Enter driver name"<<endl;
fflush(stdin);
cin.getline(drv[count].name,50);
cout<<"Enter driver age"<<endl;
cin>>drv[count].age;
cout<<"Enter driver address"<<endl;
fflush(stdin);
cin.getline(drv[count].address,50);
cout<<"Enter driver lience"<<endl;
cin>>drv[count].lience[6];
cout<<"Enter driver lience type"<<endl;
fflush(stdin);
cin.getline(drv[count].type,5);
// writting in file start here
ofstream file;
file.open("drivers.txt",ios::app);
file<<"Name : "<<drv[count].name<<endl;
file<<"Age : "<<drv[count].age<<endl;
file<<"Address: "<<drv[count].address<<endl;
file<<"lience: "<<drv[count].lience<<endl;
file<<"Type"<<drv[count].type<<endl;
file.close();
break;
}
}
}break;
case '2':// car Iquiry system
{
char opt;//option to select
cout<<" CAR INQUIRY SYSTEM"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>opt;
switch(opt)
{
case '1':
{/////////////////////////////////Write all the information of all the cars/////////////////////////////////////////
int wheels=75;
vehicles cars[75];
cout<<"Enter data of 75 Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter Cars"<<endl;
fflush(stdin);
cin.getline(cars[count].car,10);
cout<<"Enter Car model"<<endl;
cin>>cars[count].model;
cout<<"Enter Car color"<<endl;
fflush(stdin);
cin.getline(cars[count].color,10);
cout<<"Enter Cars lience "<<endl;
cin.getline(cars[count].carlience,10);
cout<<"Enter driver Plate number"<<endl;
fflush(stdin);
cin.getline(cars[count].plate,10);
// writting in file start here
ofstream file;
file.open("CARENQURIES.txt",ios::app);
file<<"Car : "<<cars[count].car<<endl;
file<<"Lience: "<<cars[count].carlience<<endl;
file<<"Color :"<<cars[count].color<<endl;
file<<"Model :"<<cars[count].model<<endl;
file<<"Plate : "<<cars[count].plate<<endl;
file.close();
// to write new file
}
break;
}
case '2':
{
/////////////////////////// Read all the information of the car inquiry//////////////////////////////////////////////////////////
ifstream file;
file.open("CARENQURIES.txt");
string retunr;
if(file)
{
while(getline(file, retunr))
{
cout<<retunr<<endl;
}
}
file.close();
// read the file
break;
}
case '3':
{
////////////////////// Edit the file information of the car inquiry///////////////////////////////////////////////////////////////
int wheels;
vehicles cars[75];
cout<<"Enter no of cars data"<<endl;
cin>>wheels;
for(int count=0;count<wheels;count++)
{
cout<<"Enter Cars"<<endl;
fflush(stdin);
cin.getline(cars[count].car,10);
cout<<"Enter Car model"<<endl;
cin>>cars[count].model;
cout<<"Enter Car color"<<endl;
fflush(stdin);
cin.getline(cars[count].color,10);
cout<<"Enter Cars lience "<<endl;
cin.getline(cars[count].carlience,10);
cout<<"Enter driver Plate number"<<endl;
fflush(stdin);
cin.getline(cars[count].plate,10);
// writting in file start here
ofstream file;
file.open("CARENQURIES.txt",ios::app);
file<<"Car : "<<cars[count].car<<endl;
file<<"Lience: "<<cars[count].carlience<<endl;
file<<"Color :"<<cars[count].color<<endl;
file<<"Model :"<<cars[count].model<<endl;
file<<"Plate : "<<cars[count].plate<<endl;
file.close();
break;
}
///////////////////// for loop ////////////////////////////////
} break;
//////////////// case 3 ends///////////////////////////////////
} /////////////// End of switch in case 3///////////////////////
} //// end of car inquiry////////////////////////////////////////
case '3':
{
char in;//////////////////////////option to select ///////////////////////////////
cout<<"Routine and Messenger Management"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>in;
switch(in)
{
case '1':
{
///////////// to write new file//////////////////////////
break;
}
case '2':
{
// read the file
break;
}
case '3':
{
// edit the file
break;
}
break;
}//////// End of switch ///////////////////////////////////
} ////////////// end of car routine ///////////////////////////
case '4':
{
char input;
cout<<"\tVehicles Maintaince"<<endl;
cout<<endl;
cout<<"1- Write 2-Read 3- Edit"<<endl;
cin>>input;
switch(input)
{
case '1':
{
int wheels=75;
mtain cart[75];
cout<<"Enter Routine for 75 Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter month"<<endl;
fflush(stdin);
cin.getline(cart[count].month,10);
cout<<"Enter Maintaince"<<endl;
fflush(stdin);
cin.getline(cart[count].miantaince,5);
cout<<"Enter Petrol"<<endl;
fflush(stdin);
cin.getline(cart[count].petrol,5);
cout<<"Enter Total Monthly Driver Pay"<<endl;
fflush(stdin);
cin.getline(cart[count].totalmonthlydrvpay,10);
cout<<"Enter Company Profit "<<endl;
cin.getline(cart[count].totalcompanyprofit,15);
cout<<"Enter Total Income "<<endl;
fflush(stdin);
cin.getline(cart[count].totalincome,15);
// writting in file start here
ofstream file;
file.open("Maintaince.txt",ios::app);
file<<"Month: "<<cart[count].month<<endl;
file<<"Petrol"<<cart[count].petrol<<endl;
file<<"Maintaince"<<cart[count].miantaince<<endl;
file<<"Total Company profit "<<cart[count].totalcompanyprofit<<endl;
file<<"Total Income"<<cart[count].totalincome<<endl;
file<<"Total Monthly Driver Pay"<<cart[count].totalmonthlydrvpay;
break;
}
}
case'2':
{
/////////////////////////// Read all the information of the car inquiry//////////////////////////////////////////////////////////
ifstream file;
file.open("Maintaince.txt");
string retunr;
if(file)
{
while(getline(file, retunr))
{
cout<<retunr<<endl;
}
}
file.close();
// read files//
break;
}
case '3':
{
int wheels;
mtain cart[75];
cout<<"Enter no of routine you want to add "<<endl;
cin>>wheels;
cout<<"Enter Routine Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter month"<<endl;
fflush(stdin);
cin.getline(cart[count].month,10);
cout<<"Enter Maintaince"<<endl;
fflush(stdin);
cin.getline(cart[count].miantaince,5);
cout<<"Enter Petrol"<<endl;
fflush(stdin);
cin.getline(cart[count].petrol,5);
cout<<"Enter Total Monthly Driver Pay"<<endl;
fflush(stdin);
cin.getline(cart[count].totalmonthlydrvpay,10);
cout<<"Enter Company Profit "<<endl;
cin.getline(cart[count].totalcompanyprofit,15);
cout<<"Enter Total Income "<<endl;
fflush(stdin);
cin.getline(cart[count].totalincome,15);
// writting in file start here
ofstream file;
file.open("Maintaince.txt",ios::app);
file<<"Month: "<<cart[count].month<<endl;
file<<"Petrol"<<cart[count].petrol<<endl;
file<<"Maintaince"<<cart[count].miantaince<<endl;
file<<"Total Company profit "<<cart[count].totalcompanyprofit<<endl;
file<<"Total Income"<<cart[count].totalincome<<endl;
file<<"Total Monthly Driver Pay"<<cart[count].totalmonthlydrvpay;
}///////////////end of for loop/////////////////////////////////
break;
}////////endd of case 3/////////////////////////////////////////////
break;
}///////////////// end of switch statement of case 4////////////////////////
}/////////////end of case 4 //////////////////////////////////////////////////
break;
}
}
}
}
}
cout<<"Would you like to continue"<<endl;
cin>>press;}
while(press==y)
}//////////////////////////end of main function////////////////////
EHISHAM-UL-HAQ
ATHAR FAROOQ
SOURCE CODE:
#include <iostream>
#include <conio.h>
#include <string>
#include <stdio.h>
#include <fstream>
using namespace std;
void main()
{
do{char select ;
cout<<"\t\t\t TAXI RESERVATION SYSTEM"<<endl;
cout<<"\tPress '1' for Taxi Reservation"<<endl;
cout<<"\tPress '2' for Management"<<endl;
cin>>select;
switch (select)
{
case '1':
{
//col row
char cars[10][10]={"ALTO",
"MEHRAN",
"CULTUS",
"CITY",
"BELINO",
"HONDA",
"CAROLA",
"MERCEDES",
"MERGALLA",
"LIANA"};
char location[13][15]={
"Nazimabab",
"North Karachi ",
"Gulshan",
"Defence",
"Tower",
"Tariq Road",
"Clifton",
"Airport",
"Liyari",
"Malire",
"Steel Town",
"Saddar",
"Johour"};
double prices[10][13]={
{20,30,40,50,60,70,80,70,50,40,30,20,10},
{10,1.28,1.38,1.48,1.58,1.68,1.78,1.88,1.98,2.08,2.20,2.30,2.40},
{20,1.32,1.42,1.52,1.62,1.72,1.82,1.92,2.02,2.15,2.25,2.35,2.45},
{30,1.45,1.52,1.63,1.74,1.85,1.96,2.09,2.18,2.32,2.45,2.56,2.78},
{40,1.54,1.65,1.74,1.83,1.92,2.09,2.18,2.28,2.42,2.65,2.76,2.88},
{50,1.67,1.78,1.87,1.98,2.18,2.20,2.32,2.45,2.56,2.69,2.78,2.95},
{60,1.78,1.87,1.99,2.10,2.30,2.45,2.55,2.65,2.72,2.82,2.98,3.01},
{70,1.82,1.92,2.09,2.18,2.29,2.32,2.45,2.56,2.67,2.87,2.97,3.09},
{80,1.98,2.08,2.19,2.36,2.56,2.76,2.89,3.12,3.26,3.40,3.55,3.67},
{90,2.09,2.18,2.32,2.45,2.78,2.98,3.18,3.36,3.67,3.89,4.09,4.25}
};
double prices2[13][13]={
{10,30,20,40,50,60,70,20,20,10,20,30,20},
{48,28,38,48,58,68,78,88,98,120,140,160,180},
{40,32,42,52,62,72,82,92,120,140,160,180,245},
{50,45,52,63,74,85,96,100,140,160,180,200,278},
{60,54,65,74,83,92,100,120,160,180,200,225,276},
{70,67,78,87,98,100,120,140,180,200,220,256,295},
{80,78,87,99,100,120,140,160,200,220,240,275,298},
{90,82,92,100,120,140.160,180,225,256,260,295,297,309},
{30,98,98,120,150,160,180,200,250,300,300,340,355},
{40,100,180,195,210,245,287,300,315,345,367,498,550},
{50,120,200,225,245,256,287,310,325,365,378,390,410},
{60,140,240,280,320,340,380,340,360,380,420,440,480},
{70,160,260,310,330,370,390,410,450,465,496,500,550},
};
system ("CLS");
int model[13]={2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012};
int vechicle[10],date;
char year[5],nic[20],
pick[15],
destination[15],
shift[10],
ampm,
mod[5],day[10],
car[10];
char name[50],
PM,
AM;
int hour1,hour,
minutes,
serial,
serial1,
serial2,
serial3;
double total;
cout<<"\t\t WELCOME to TAXI RESERVATION SYSTEM"<<endl;
//take personal infomation form user
cout<<"Enter Your name"<<endl;
fflush(stdin);
cin.getline(name, 50);
cout<<"Enter your NATIONAL IDENTITY CARD NUMBER (NIC)"<<endl;
cin>>nic;
cout<<endl;
cout<<"Enter your PLACE TO PICK "<<endl;
cout<<endl;
for (int row=0;row<13;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<location[row][col]<<" ";
}
cout<<endl;
}
cout<<"Place name"<<endl;
fflush(stdin);
cin.getline(pick,15);
cout<<"Serial"<<endl;
cin>>serial2;
cout<<endl;
cout<<"Enter your DESTINATION"<<endl;
cout<<endl;
for (int row=0;row<13;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<location[row][col]<<" ";
}
cout<<endl;
}
fflush(stdin);
cin.getline(destination,15);
cout<<endl;
cout<<"Serial"<<endl;
cin>>serial3;
cout<<endl;
cout<<"Enter your timing hours"<<endl;
cin>>hour1;
cout<<endl;
//timing shift
do{
cout<<"Please Enter time in format of 12 or 24"<<endl;
cin>>hour;
if(hour > 23)
cout<<"Enter hour value between 0 and 23";
}
while (hour>23);
do{
cout<<"Please enter minute"<<endl;
cin>>minutes;
if(minutes>59)
cout<<"Enter minute value between 0 and 59";
}
while (minutes>59);
if(hour>12)
{
hour=hour-12;
ampm='P';
cout<<"Evening Shift ";
}
else if(hour==12)
{
ampm='P';
cout<<"Evening Shift ";
}
else
{
ampm='A';
cout<<"Morning Shift ";
}
cout<<"Date of Reservation"<<endl;
cin>>date;
cout<<"Day of Reservation"<<endl;
fflush(stdin);
cin.getline(day,10);
cout<<"Year of reservation"<<endl;
fflush(stdin);
cin.getline(year,5);
cout<<"Enter serial no of selected CAR "<<endl;
for (int row=0;row<10;row++)
{
cout<<"\t"<<row+1<<" - "<<" ";
for(int col=0;col<10;col++)
{
cout<<cars[row][col]<<" ";
}
cout<<endl;
}
cin>>car;// select what car do user want
cout<<"Serial"<<endl;
cin>>serial;
cout<<"Please select model for CAR and serial number"<<endl;
for( int digit=0;digit<13;digit++)
{
cout<<digit+1<<" "<<"-"<<model[digit]<<endl;
}
cout<<endl;
cin>>mod;
cout<<endl;
cout<<"Serial"<<endl;
cin>>serial1;
system("cls");
cout<<"\t\t\t Passenger Information"<<endl;
cout<<endl;
for(int num=0;num<8;num++)
{cout<<"\t\t\t";
for(int row=0;row<4;row++)
{
for(int col=0;col<4;col++)
{
cout<<"*";
}
cout<<" - ";
}
cout<<endl;
}
cout<<endl;
total=(serial1*prices2[serial2][serial3])+99;
///////////////////////////////////////////output of all the input information//////////////////////////////////////////////////////////
cout<<"\t\t\t Passenger Name : "<<name<<endl;
cout<<"\t\t\t Passenger NIC No : "<<nic<<endl;
cout<<"\t\t\t Pick Up Point : "<<pick<<endl;
cout<<"\t\t\t Destination : "<<destination<<endl;
cout<<"\t\t\t Selected Car : "<<car<<endl;
cout<<"\t\t\t Vechicle Model : "<<mod<<endl;
cout<<"\t\t\t The Time is "<<hour<<":"<<minutes<<ampm<<" M "<<endl;
cout<<"\t\t\t Date is "<< date<<"/"<<day<<"/"<<year<<endl;
cout<<"\t\t\t Total Payment = "<<total<<endl;
//RECTAGULAR
//////////////////////////////////////// filling start here for routine////////////////////////////////////////////////////////////////
ofstream myfile;
myfile.open("routine.txt",ios::app);
myfile<<"Passenger Name: " <<name <<endl;
myfile<<"Passenger NIC no: "<<nic<<endl;
myfile<<"Pick Up piont: "<<pick<<endl;
myfile<<"Destination"<<destination<<endl;
myfile<<"Selected Car "<<car<<endl;
myfile<<"Vehicle Model"<<mod<<endl;
myfile<<"The Time is "<<hour<<":"<<minutes<<ampm<<" M "<<endl;
myfile<<"\t\t\t Date is "<< date<<"/"<<day<<"/"<<year<<endl;
myfile<<"Total Payment "<<endl;
system ("pause");
break;
}
case '2':
{
struct driver
{
char name[50];
int age;
char address[50];
int lience[6];
char type[5];
};
struct vehicles
{
char car[10];
int model;
char plate[10];
char carlience[10];
char color[10];
};
struct mtain
{
char month[10];
char miantaince[5];
char petrol[5];
char totalmonthlydrvpay[15];
char totalcompanyprofit[15];
char totalincome[15];
};
char option;
cout<<"\t\t\tWELCOME TO TAXI MANAGEMENT"<<endl;
cout<<"\t* PRESS 1 for drivers information management"<<endl;
cout<<"\t* PRESS 2 for car inquiry"<<endl;
cout<<"\t* PRESS 3 for Routine and messenger management"<<endl;
cout<<"\t* PRESS 4 for Income generating management"<<endl;
cout<<"\t* PRESS 5 for vehicles maintenance management. "<<endl;
cin>>option;
system ("cls");
switch(option)
{
{
case '1':
{
char opt;//option to select
cout<<"DRIVER INFORMATION MANAGEMENT"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>opt;
switch(opt)
{
case '1':
{///////////////////////////////// to write new file///////////////////////////////////////////////////////
driver drv[150];
char name[50],adress[50],type[5];
int age,lience[6],drivers=150;
cout<<"Enetr Data of 150 drivers"<<endl;
for(int count=0;count<drivers;count++)
{
cout<<"Enter driver name"<<endl;
fflush(stdin);
cin.getline(drv[count].name,50);
cout<<"Enter driver age"<<endl;
cin>>drv[count].age;
cout<<"Enter driver address"<<endl;
fflush(stdin);
cin.getline(drv[count].address,50);
cout<<"Enter driver lience"<<endl;
cin>>drv[count].lience[6];
cout<<"Enter driver lience type"<<endl;
fflush(stdin);
cin.getline(drv[count].type,5);
// writting in file start here
ofstream file;
file.open("driver.txt",ios::app);
file<<drv[count].name<<endl;
file<<drv[count].age<<endl;
file<<drv[count].address<<endl;
file<<drv[count].lience<<endl;
file<<drv[count].type<<endl;
file.close();
}
break;
}
case '2':
{
/////////////////////////////// read the file/////////////////////////////////////////////////////////
ifstream file;
file.open("drivers.txt");
string retrieve;
if(file)
{
while(getline(file, retrieve))
{
cout<<retrieve<<endl;
}
}
file.close();
break;
}
case '3':
{
// //////////////////////////////Edit the file ////////////////////////////////////////////////////////
driver drv[150];
char name[50],adress[50],type[5];
int age,lience[6],drivers;
cout<<"NO of drivers maximum 150"<<endl;
cin>>drivers;
for(int count=0;count<drivers;count++)
{
cout<<"Enter driver name"<<endl;
fflush(stdin);
cin.getline(drv[count].name,50);
cout<<"Enter driver age"<<endl;
cin>>drv[count].age;
cout<<"Enter driver address"<<endl;
fflush(stdin);
cin.getline(drv[count].address,50);
cout<<"Enter driver lience"<<endl;
cin>>drv[count].lience[6];
cout<<"Enter driver lience type"<<endl;
fflush(stdin);
cin.getline(drv[count].type,5);
// writting in file start here
ofstream file;
file.open("drivers.txt",ios::app);
file<<"Name : "<<drv[count].name<<endl;
file<<"Age : "<<drv[count].age<<endl;
file<<"Address: "<<drv[count].address<<endl;
file<<"lience: "<<drv[count].lience<<endl;
file<<"Type"<<drv[count].type<<endl;
file.close();
break;
}
}
}break;
case '2':// car Iquiry system
{
char opt;//option to select
cout<<" CAR INQUIRY SYSTEM"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>opt;
switch(opt)
{
case '1':
{/////////////////////////////////Write all the information of all the cars/////////////////////////////////////////
int wheels=75;
vehicles cars[75];
cout<<"Enter data of 75 Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter Cars"<<endl;
fflush(stdin);
cin.getline(cars[count].car,10);
cout<<"Enter Car model"<<endl;
cin>>cars[count].model;
cout<<"Enter Car color"<<endl;
fflush(stdin);
cin.getline(cars[count].color,10);
cout<<"Enter Cars lience "<<endl;
cin.getline(cars[count].carlience,10);
cout<<"Enter driver Plate number"<<endl;
fflush(stdin);
cin.getline(cars[count].plate,10);
// writting in file start here
ofstream file;
file.open("CARENQURIES.txt",ios::app);
file<<"Car : "<<cars[count].car<<endl;
file<<"Lience: "<<cars[count].carlience<<endl;
file<<"Color :"<<cars[count].color<<endl;
file<<"Model :"<<cars[count].model<<endl;
file<<"Plate : "<<cars[count].plate<<endl;
file.close();
// to write new file
}
break;
}
case '2':
{
/////////////////////////// Read all the information of the car inquiry//////////////////////////////////////////////////////////
ifstream file;
file.open("CARENQURIES.txt");
string retunr;
if(file)
{
while(getline(file, retunr))
{
cout<<retunr<<endl;
}
}
file.close();
// read the file
break;
}
case '3':
{
////////////////////// Edit the file information of the car inquiry///////////////////////////////////////////////////////////////
int wheels;
vehicles cars[75];
cout<<"Enter no of cars data"<<endl;
cin>>wheels;
for(int count=0;count<wheels;count++)
{
cout<<"Enter Cars"<<endl;
fflush(stdin);
cin.getline(cars[count].car,10);
cout<<"Enter Car model"<<endl;
cin>>cars[count].model;
cout<<"Enter Car color"<<endl;
fflush(stdin);
cin.getline(cars[count].color,10);
cout<<"Enter Cars lience "<<endl;
cin.getline(cars[count].carlience,10);
cout<<"Enter driver Plate number"<<endl;
fflush(stdin);
cin.getline(cars[count].plate,10);
// writting in file start here
ofstream file;
file.open("CARENQURIES.txt",ios::app);
file<<"Car : "<<cars[count].car<<endl;
file<<"Lience: "<<cars[count].carlience<<endl;
file<<"Color :"<<cars[count].color<<endl;
file<<"Model :"<<cars[count].model<<endl;
file<<"Plate : "<<cars[count].plate<<endl;
file.close();
break;
}
///////////////////// for loop ////////////////////////////////
} break;
//////////////// case 3 ends///////////////////////////////////
} /////////////// End of switch in case 3///////////////////////
} //// end of car inquiry////////////////////////////////////////
case '3':
{
char in;//////////////////////////option to select ///////////////////////////////
cout<<"Routine and Messenger Management"<<endl;
cout<<"1- Write 2- Read 3- Edit"<<endl;
cin>>in;
switch(in)
{
case '1':
{
///////////// to write new file//////////////////////////
break;
}
case '2':
{
// read the file
break;
}
case '3':
{
// edit the file
break;
}
break;
}//////// End of switch ///////////////////////////////////
} ////////////// end of car routine ///////////////////////////
case '4':
{
char input;
cout<<"\tVehicles Maintaince"<<endl;
cout<<endl;
cout<<"1- Write 2-Read 3- Edit"<<endl;
cin>>input;
switch(input)
{
case '1':
{
int wheels=75;
mtain cart[75];
cout<<"Enter Routine for 75 Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter month"<<endl;
fflush(stdin);
cin.getline(cart[count].month,10);
cout<<"Enter Maintaince"<<endl;
fflush(stdin);
cin.getline(cart[count].miantaince,5);
cout<<"Enter Petrol"<<endl;
fflush(stdin);
cin.getline(cart[count].petrol,5);
cout<<"Enter Total Monthly Driver Pay"<<endl;
fflush(stdin);
cin.getline(cart[count].totalmonthlydrvpay,10);
cout<<"Enter Company Profit "<<endl;
cin.getline(cart[count].totalcompanyprofit,15);
cout<<"Enter Total Income "<<endl;
fflush(stdin);
cin.getline(cart[count].totalincome,15);
// writting in file start here
ofstream file;
file.open("Maintaince.txt",ios::app);
file<<"Month: "<<cart[count].month<<endl;
file<<"Petrol"<<cart[count].petrol<<endl;
file<<"Maintaince"<<cart[count].miantaince<<endl;
file<<"Total Company profit "<<cart[count].totalcompanyprofit<<endl;
file<<"Total Income"<<cart[count].totalincome<<endl;
file<<"Total Monthly Driver Pay"<<cart[count].totalmonthlydrvpay;
break;
}
}
case'2':
{
/////////////////////////// Read all the information of the car inquiry//////////////////////////////////////////////////////////
ifstream file;
file.open("Maintaince.txt");
string retunr;
if(file)
{
while(getline(file, retunr))
{
cout<<retunr<<endl;
}
}
file.close();
// read files//
break;
}
case '3':
{
int wheels;
mtain cart[75];
cout<<"Enter no of routine you want to add "<<endl;
cin>>wheels;
cout<<"Enter Routine Cars"<<endl;
for(int count=0;count<wheels;count++)
{
cout<<"Enter month"<<endl;
fflush(stdin);
cin.getline(cart[count].month,10);
cout<<"Enter Maintaince"<<endl;
fflush(stdin);
cin.getline(cart[count].miantaince,5);
cout<<"Enter Petrol"<<endl;
fflush(stdin);
cin.getline(cart[count].petrol,5);
cout<<"Enter Total Monthly Driver Pay"<<endl;
fflush(stdin);
cin.getline(cart[count].totalmonthlydrvpay,10);
cout<<"Enter Company Profit "<<endl;
cin.getline(cart[count].totalcompanyprofit,15);
cout<<"Enter Total Income "<<endl;
fflush(stdin);
cin.getline(cart[count].totalincome,15);
// writting in file start here
ofstream file;
file.open("Maintaince.txt",ios::app);
file<<"Month: "<<cart[count].month<<endl;
file<<"Petrol"<<cart[count].petrol<<endl;
file<<"Maintaince"<<cart[count].miantaince<<endl;
file<<"Total Company profit "<<cart[count].totalcompanyprofit<<endl;
file<<"Total Income"<<cart[count].totalincome<<endl;
file<<"Total Monthly Driver Pay"<<cart[count].totalmonthlydrvpay;
}///////////////end of for loop/////////////////////////////////
break;
}////////endd of case 3/////////////////////////////////////////////
break;
}///////////////// end of switch statement of case 4////////////////////////
}/////////////end of case 4 //////////////////////////////////////////////////
break;
}
}
}
}
}
cout<<"Would you like to continue"<<endl;
cin>>press;}
while(press==y)
}//////////////////////////end of main function////////////////////
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.