برنامه مدیریت سفر در C++
//************* JAHANGEER TRAVEL MANAGENMENT *****************
#include
#include
#include
#include
#include
#include
#include
#include
long int code;
class persdetails //class for collecting the personal details
{
int trvlcode;
int age[20];
char name[20][20];
char add[50];
char phnum[15];
char sex[20];
char passnum[10][10];
char familyname[30];
int num;
int numppl;
public:
void p_input(int);
void p_output();
void givefam();
int givecode();
int give();
}pob;
int persdetails::give()
{
return num;
}
void persdetails::givefam()
{
cout<>numppl;
clrscr();
if(numppl>0)
{
cout<<"\n\t\tPlease Enter The Details of each Member/Members: "<>age[i];
cout<<"\n\t\tSex (M/F): ";
cin>>sex[i];
cout<<"\n\t\tPassport Number: ";
gets(passnum[i]);
if(age[i]>5)
{
num++; //to calculate no of travellers below 5 yrs
}
}
}
}
void persdetails::p_output() //output func() of class1
{
clrscr();
cout<<"\n\n\t******************** PERSONAL DETAILS ********************"<>opt;
switch(opt)
{
case 1:clrscr();
cout<<"\n\n\n\t\t\tSelect Boarding point:\n\n\t\t\t1.Mumbai\n\n\t\t\t2.Cochin\n\n\t\t\t3.Chennai\n\n\t\t\t ";
cin>>bdg_pt;
break;
case 2:clrscr();
cout<<"\n\n\t\t\t****** Select Destination ******\n\n\n";
cout<<"\t 1.New York\t\t6.Dubai\t\t\t11.Antananariv";
cout<<"\n\n\t 2.Miami\t\t7.Lisbon\t\t12.Cairo\n\n";
cout<<"\t 3.Rio De Janeiro\t8.London\t\t13.Perth";
cout<<"\n\n\t 4.Colombo\t\t9.Copenhagen\t\t14.Sydney";
cout<<"\n\n\t 5.Hong Kong\t\t10.Cape Town\t\t15.Wellington\n\n\n\n\n\t\t\t\t ";
cin>>go_pt;
break;
case 3:clrscr();
cout<<"\n\n\t Date of Departure ";
cout<<"\n\n * Note:Format for entering:Day(press enter)Month(press enter)Year *";
cout<<"\n\n\t\tEnter your preferred date of departure: ";
cin>>day;
gotoxy(59,7); //to create a paricular format for entry
cout<<"/";
cin>>month;
gotoxy(62,7);
cout<<"/";
cin>>year;
break;
case 4:clrscr();
cout<<"\n\n\t\t\tEnter The Choice OF Deck\n\n\t\t\t1.Top Deck\n\n\t\t\t2.Middle Decks\n\n\t\t\t3.Bottom Deck\n\n\t\t\t ";
cin>>deck;
break;
case 5:clrscr();
cout<<"\n\n\t\t\tEnter The Choice Of Cabin\n\n\t\t\t1.AC\n\n\t\t\t2.Non AC\n\n\t\t\t ";
cin>>cabin;
break;
case 6:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of A Swimming Pool\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>pool;
pool--;
break;
case 7:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of A Gymnasium\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>gym;
gym--;
break;
case 8:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Sports Facilities Offered\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>sports;
sports--;
break;
case 9:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of Beauty Salon\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>salon;
salon--;
break;
case 10:clrscr();
cout<<"\n\n\tDo You Like To Avail The Facility Of Spa and Ayurvedic Treatment\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>spa;
spa--;
break;
case 11:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of Amphitheatre\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>theatre;
theatre--;
break;
case 12:i=0;
break;
}
}while(i==1);
}
void boardpt(int c) //for easy o/p
{
if(c==1)
cout<<"Mumbai\t";
if(c==2)
cout<<"Cochin\t";
if(c==3)
cout<<"Chennai\t";
}
void dest(int d) //for easy o/p
{
switch(d)
{
case 1:cout<<"New York";
break;
case 2:cout<<"Miami";
break;
case 3:cout<<"Rio De Janero";
break;
case 4:cout<<"Colombo";
break;
case 5:cout<<"Hong Kong";
break;
case 6:cout<<"Dubai";
break;
case 7:cout<<"Lisbon";
break;
case 8:cout<<"London";
break;
case 9:cout<<"Copenhagen";
break;
case 10:cout<<"Cape Town";
break;
case 11:cout<<"Antananriv";
break;
case 12:cout<<"Cairo";
break;
case 13:cout<<"Perth";
break;
case 14:cout<<"Sydney";
break;
case 15:cout<<"Willington";
break;
}
}
void travdetails::t_output() //output func()-class2
{
clrscr();
cout<<"\n\n\t******************* TRAVEL DETAILS *********************";
cout<<"\n\n\t\tBoarding Point: ";
boardpt(bdg_pt);
cout<<"\n\n\t\tDestination: ";
dest(go_pt);
cout<<"\n\n\t\tDate of departure: ";
cout<31)
{
month=month+1;
day=day%31;
}
}
if(month==4||month==6||month==9||month==11)
{
if(day>30)
{
month=month+1;
day=day%30;
}
}
if(month==2)
{
if(day>28)
{
month=month+1;
day=day%28;
}
}
if(month==13)
{
month=1;
year++;
}
cout<<"\n\n\t\tDate of Arrival: ";
cout<100000) //to provide comma's for grandtotal
{
cout<1000)
{
cout<>opt;
switch(opt)
{
case 1:do
{
clrscr();
cout<<"\n\n\n\t\t\t\t NEW USER\n";
cout<<"\t\t\t\t ********\n\n";
cout<<"\n\n\t\t\tChoose the type of details you want to enter:";
cout<<"\n\n\t\t\t\t1.Personal Details\n\n\t\t\t\t2.Travel Details\n\n\t\t\t\t3.Back\n\n\t\t\t\t ";
cin>>opt1;
switch(opt1)
{
case 1:code++;
pob.p_input(code);
ofstream ofl("PersonalDetails.txt",ios::binary|ios::app);
if(!ofl)
cout<<"\n\n\t\tSorry.The File Cannot Be Opened For Writing"<>acceptcode;
if(acceptcode>code)
{
cout<<"\nNo such record has been created!";
break;
}
family(acceptcode,flag);
cout<>opt2;
switch(opt2)
{
case 1:ifstream ifl("PersonalDetails.txt",ios::binary);
if(!ifl)
cout<<"\nError";
ifl.read((char*)&pob,sizeof(pob));
while(!ifl.eof())
{
if(pob.givecode()==acceptcode)
{
break;
}
ifl.read((char*)&pob,sizeof(pob));
}
pob.p_output();
ifl.close();
break;
case 2:ifstream ifl1("TravelDetails.txt",ios::binary);
if(!ifl1)
cout<<"\nError";
ifl1.read((char*)&tob,sizeof(tob));
while(!ifl1.eof())
{
if(tob.gtcode()==acceptcode)
{
break;
}
ifl1.read((char*)&tob,sizeof(tob));
}
tob.t_output();
ifl1.close();
break;
case 3:do
{
clrscr();
cout<<"\n\n\n\t Edit Details ";
cout<<"\n\n\t\tPlease select from among the editing options:\n\n";
cout<<"\t\t\t\t1.Modify\n\n\t\t\t\t2.Delete\n\n\t\t\t\t3.Back\n\n\t\t\t\t ";
cin>>opt3;
switch(opt3)
{
case 1:do
{
clrscr();
cout<<"\n\n\t\t Modificaton \n";
cout<<"\t\t ~~~~~~~~~~~";
cout<<"\n\n\tChoose The Type Of Details You Want To Modify:\n\n\t\t\t1.Personal Details\n\n\t\t\t2.Travel Details\n\n\t\t\t3.Back\n\n\t\t\t ";
cin>>opt4;
switch(opt4)
{
case 1:editp(acceptcode);
break;
case 2:editt(acceptcode);
break;
case 3:break;
}
}while(opt4!=3);
break;
case 2:deletion(acceptcode);
opt3=3;
opt2=5;
break;
case 3:break;
}
}while(opt3!=3);
break;
case 4:ifstream ifl3("PersonalDetails.txt",ios::binary);
if(!ifl3)
cout<<"\nError";
ifl3.read((char*)&pob,sizeof(pob));
while(!ifl3.eof())
{
if(pob.givecode()==acceptcode)
{
break;
}
ifl3.read((char*)&pob,sizeof(pob));
}
ifstream ifl2("TravelDetails.txt",ios::binary);
if(!ifl2)
cout<<"\nError";
ifl2.read((char*)&tob,sizeof(tob));
while(!ifl2.eof())
{
if(tob.gtcode()==acceptcode)
{
break;
}
ifl2.read((char*)&tob,sizeof(tob));
}
tob.accept(pob.give());
tob.compute();
ifl2.close();
break;
case 5:break;
}
}while(opt2!=5);
}
break;
case 3:ofstream fil("INITIALL.txt",ios::binary); //storing code value
if(!fil)
cout<<"\nError";
fil.write((char*)&code,sizeof(code));
fil.close();
clrscr();
cout<<"\n\n";
cout<<" _/_/_/_/_/ _/ _/ \n";
cout<<" _/ _/_/_/ _/_/_/ _/_/_/ _/ _/ \n";
cout<<" _/ _/ _/ _/ _/ _/ _/ _/_/ \n";
cout<<" _/ _/ _/ _/ _/ _/ _/ _/ _/ \n";
cout<<" _/ _/ _/ _/_/_/ _/ _/ _/ _/ \n";
cout<<" \n";
cout<<" \n";
cout<<" \n";
cout<<" _/ _/ \n";
cout<<" _/ _/ _/_/ _/ _/ \n";
cout<<" _/ _/ _/ _/ _/ \n";
cout<<" _/ _/ _/ _/ _/ \n";
cout<<" _/ _/_/ _/_/_/ \n\n";
cout<<"\t |===| ~~\n";
cout<<" _| |____________________________________________|| ||___ ";
cout<<"\t\t |_|_|_|_\__()____()____()______()______()_____()__||_||__/"<
توضیحات:
صورت سوال:
برنامه مدیریت سفر در C++
این برنامه تمامی امکانات مدیریت سفر را در محیط CMD در اختیار شما میگذارد.
شما میتوانید سوالات خود را از طریق ایمیل پشتیبانی – تماس با ما – یا در قسمت نظرات سوال خود را بپرسید.
موفق باشید
A.J