English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# define p 240

char strin[20];
//following functions are used by the programmer to
//edit,append,delete data using progmammer function
//which can be accessed by pass function.
void pass(void);
void edit(void);
void append(void);
void recshow(void);
void dodelete(void);
void programmer(void);

//structure declaration to store names of
//trains and attractions.
struct arr{ char name[5][20]; };
struct tr { char names[2][20]; };
//declaration of class TOUR
class TOUR{
private:
char destination[20];
char state[20];
char season[20];
char cost[20];
tr trains;
tr timings;
arr attractions;
tr hotels;
char type[20];
char sp[160];
public:
void read_data(void);
void show_data(void);
int compare(char string[20])
{
if (strcmp(destination,string)==0)
return 1;
else
return 0;
}
void give_destination()
{
strcpy(strin,destination);}
}
//globally defined objects for class TOUR.
twork,worker;
//function used in the program to hold the screen
void wait(void)
{
cout<<"\nPRESS ANY KEY TO CONINUE \n";
getch();
}
//public function of class TOUR which reads data input by the programmer
void TOUR::read_data()
{
clrscr();
int blank,x,i,j,l;
cout<<"\n-----------------------------------ENTER DATA------------";
cout<<"---------------------- \n";
cout<<"DESTINATION "; gets(destination);
l=strlen(destination);
for (j=0;j<=l;j++)
destination[j]=toupper(destination[j]);
blank=20-strlen(destination);
for(x=1;x<=blank;x++)
strcat(destination," ");
destination[19]='\0';

cout<<"STATE "; gets(state);
l=strlen(state);
for(j=0;j<=l;j++)
state[j]=toupper(state[j]);
blank=20-strlen(state);
for (x=1;x<=blank;x++)
strcat(state," ");
state[19]='\0';

cout<<"SEASON "; gets(season);
l=strlen(season);
for(j=0;j<=l;j++)
season[j]=toupper(season[j]);
blank=20-strlen(season);
for(x=1;x<=blank;x++)
strcat(season," ");
season[19]='\0';

cout<<"COST "; gets(cost);
l=strlen(cost);
for(j=0;j<=l;j++)
cost[j]=toupper(cost[j]);
blank=20-strlen(cost);
for(x=1;x<=blank;x++)
strcat(cost," ");
cost[19]='\0';

cout<<"TRAINS ";
for (j=0;j<2;j++)
{
gets(trains.names[j]);
l=strlen(trains.names[j]);
for(i=0;i<=l;i++)
trains.names[j][i]=toupper(trains.names[j][i]);
blank=20-strlen(trains.names[j]);
for(x=1;x<=blank;x++)
strcat(trains.names[j]," ");
trains.names[j][19]='\0';
}

cout<<"TIMINGS ";
for (j=0;j<2;j++)
{
gets(timings.names[j]);
l=strlen(timings.names[j]);
for(i=0;i<=l;i++)
timings.names[j][i]=toupper(timings.names[j][i]);
blank=20-strlen(timings.names[j]);
for(x=1;x<=blank;x++)
strcat(timings.names[j]," ");
timings.names[j][19]='\0';
}

cout<<"ATRRACTIONS ";
for(i=0;i<5;i++)
{
gets(attractions.name[i]);
l=strlen(attractions.name[i]);
for(j=0;j<=l;j++)
attractions.name[i][j]=toupper(attractions.name[i][j]);
blank=20-strlen(attractions.name[i]);
for(x=1;x<=blank;x++)
strcat(attractions.name[i]," ");
attractions.name[i][19]='\0';
}

cout<<"HOTELS ";
for (j=0;j<2;j++)
{
gets(hotels.names[j]);
l=strlen(hotels.names[j]);
for(i=0;i<=l;i++)
hotels.names[j][i]=toupper(hotels.names[j][i]);
blank=20-strlen(hotels.names[j]);
for(x=1;x<=blank;x++)
strcat(hotels.names[j]," ");
hotels.names[j][19]='\0';
}

cout<<"TYPE "; gets(type);
l=strlen(type);
for(j=0;j<=l;j++)
type[j]=toupper(type[j]);
blank=20-strlen(type);
for(x=1;x<=blank;x++)
strcat(type," ");
type[19]='\0';

cout<<"SPECIALITY "; gets(sp);
l=strlen(sp);
for(j=0;j<=l;j++)
sp[j]=toupper(sp[j]);
blank=20-strlen(sp);
for(x=1;x<=blank;x++)
strcat(sp," ");
sp[159]='\0';
}
//public function of class TOUR which displays data on the screen
void TOUR::show_data()
{
clrscr();
cout<<"\n*************************VARIOUS TOURIST PLACES ARE AS***";
cout<<"************************\n";
cout< cout< "< "< cout< "< "< cout< "< "
< cout< < cout< "< "
< cout< < cout< "
< cout< cout< cout< cout< cout<<"\n********************************************************";
cout<<"***********************\n";
wait();
}

void recshow()
{
clrscr();
fstream tfile("tourism.dat",ios::binary|ios::out|ios::in);
cout<<"CONTENTS OF FILE ARE AS\n";
tfile.seekg(0,ios::beg);
tfile.read((char*)&worker,sizeof(TOUR));
while (!tfile.eof())
{
worker.show_data();
tfile.read((char*)&worker,sizeof(TOUR));
}
tfile.close();
cout<<" DESIRED RECORD(S) ARE DISLPLAYED \n";
}

void append()
{
clrscr();
char ch;
int recno;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::end);
recno=tfile.tellg()/sizeof(TOUR);
cout<<"\n NO OF RECORDS IN FILE ARE AS "< do
{ cout<<"\n WANT TO ENTER MORE DATA Y/N \n";
ch=toupper(getche());
if (ch=='Y')
{
cout<<"\n RECORD NUMBER "< twork.read_data();
twork.give_destination();
cout<<"\n YOUR DESTINATION WAS "< tfile.seekg(0,ios::beg);
int found=0;
while (!tfile.eof()&&!found)
{
tfile.read((char*)&worker,sizeof(TOUR));
if (worker.compare(strin))
found=1;
}
if (!found)
{
tfile.clear();
recno++;
tfile.seekp(0,ios::end);
tfile.write((char*)&twork,sizeof (TOUR));
cout<<" \nNEW RECORD IS ENTERED SUCCESFULLY\n";
}
else
{
cout<<" !!! THIS DESTINATION ALREADY EXISTS !!!\n";
wait();
recshow();
}
}
}
while(ch=='Y');
tfile.close();
}

void edit()
{
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
cout<<"ENTER DESTINATION FOR WHICH YOU WANT TO EDIT RECORD \n";
gets(strin);
int l=strlen(strin);
for (int j=0;j<=l;j++)
strin[j]=toupper(strin[j]);
int blank=20-strlen(strin);
for(int x=1;x strcat(strin," ");
strin[19]='\0';
int found=0;
while (!tfile.eof() && !found)
{
tfile.read((char*)&worker,sizeof(TOUR));
if (worker.compare(strin))
found=1;
}
if(!found)
cout<<"\n NO RECORD FOUND FOUND IN THIS DESTINATION\n";
else
{
worker.show_data();
worker.read_data();
tfile.seekp(tfile.tellp()-sizeof(worker));
tfile.write((char*)&worker,sizeof(TOUR));
cout<<" EDITED RECORD IS SAVED SUCCESSFULLY \n";
}
wait();
tfile.close();
}

void dodelete()
{
fstream tfile ("tourism.dat",ios::binary|ios::out|ios::in);
int found=0;
char ok;
cout<<"\n ENTER DESTINATION TO DELETE THE RECORD\n";
gets(strin);
int l=strlen(strin);
for (int j=0;j<=l;j++)
strin[j]=toupper(strin[j]);
int blank=20-strlen(strin);
for(int x=1;x strcat(strin," ");
strin[19]='\0';
while (!tfile.eof()&&!found)
{
tfile.read((char*)&worker,sizeof(worker));
if(worker.compare(strin))
found=1;
}
if(!found)
{
cout<<"\n NO SUCH RECORD FOUND\n";
wait();
}
else
{
recshow();
cout<<"\nWANT TO DELETE THIS RECORD Y/N \n";
ok=toupper(getche());
if(ok=='Y')
{
fstream mtemp("temp.dat",ios::binary|ios::in|ios::out);
tfile.seekg(ios::beg);
tfile.read((char*)&worker,sizeof(worker));
tfile.clear();
while(!tfile.eof())
{
if(!worker.compare(strin))
mtemp.write((char*)&worker,sizeof(worker));
tfile.read((char*)&worker,sizeof(worker));
}
tfile.close();
mtemp.close();
remove("tourism.dat");
if (rename("temp.dat","tourism.dat")==0)
cout<<"\nêêê RECORD IS DELETED SUCCESSFULLY êêê\n";
else
cout<<"\n!!!OPERATION IS UNSUCCESSFUL!!!\n";
wait();
}
}
}

void pass()
{
clrscr();
clearviewport();
int c=0,y=0;
char pass_word[20];
const char password[]={"210785"};
while(c<2)
{
c++;
setbkcolor(BLUE);
for (y=1;y<14;y++)
cout << endl;
cout << "\t\têêê ENTER YOUR PASSWORD êêê\n";
gotoxy(50,14);
gets(pass_word);
if(strcmp(password,pass_word)==0)
{
programmer();
break;
}
else
cout<<"ëëë BAD LUCK PASSWORD IS WRONG ëëë";
if (c<2)
//textattr(RED+BLINK);
//cprintf("\n²²² TRY ONCE MORE ²²²\r\n");
cprintf("\n²²² TRY ONCE MORE ²²²\r\n");
}
wait();
}

void programmer(void)
{
//setbkcolor(BLUE);
// textbackground(BLUE);
int ok,y;
do {
clrscr();
clearviewport();
setbkcolor(BLUE);

for(y=1;y<=3;y++)
cout<<"\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\t ";
cout<<"ENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\t\tAPPEND RECORD ---> 1 \t\t\t\t";
cout<<"\t\t\t\tEDIT RECORD ---> 2 \t\t\t\t";
cout<<"\t\t\t\tDELETE RECORD ---> 3 \t\t\t\t";
cout<<"\t\t\t\tSHOW RECORD ---> 4 \t\t\t\t";
cout<<"\t\t\t\tEXIT ---> 5 \t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=0;y<20;y++)
cout<<"\t\t\t\t\t ";
cout << "\t\t\t\t Enter choice : ";
cin>>ok;

switch(ok)
{
case 1:append();
break;
case 2: edit();
break;
case 3: dodelete();
break;
case 4: recshow();
break;
case 5:break;
default:cout<<" INVALID CHOICE \n";delay(1500);break;
}
} while(ok!=5);
}
//class which acssess the data
class TRAVEL { private:
char dest[20];
char st[20];
char seas[20];
char ct[20];
tr tra;
tr timing;
arr attract;
tr hotel;
char ty[20];
char special[160];
public:
void get_state(char tt[20]);
void get_attract(char tt[20]);
void get_read();
void get_alpha(char tt[20]);
void get_all(char tt[20]);
void get_dest(char tt[20]);
void get_season(char tt[20]);
void get_cost(char tt[20]);
void dest_seas();
void seas_state();
void state_cost();
void all();
} abc,pqr;
//member function of class TRAVEL which acssess the data.
void TRAVEL::get_read()
{
clrscr();
cout<<"\n*************************VARIOU TOURIST PLACES ARE AS***";
cout<<"************************\n";
cout< cout< "< "< cout< "< "< cout< "< "
<
cout< < cout< "< "
< cout< < cout< cout< cout< cout< cout< cout<<"\n********************************************************";
cout<<"************************\n";
wait();
}
//member function of class TRAVEL which compares destination and season
//input by the user and displays data corresponding to the same.
void TRAVEL::dest_seas()
{
char ch,destination[20],season[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER DESTINATION & SEASON FOR WHICH INFORMATION IS TO BE";
cout<<" DISPLAYED\n";
cout<<"DESTINATION "; gets(destination);
cout<<"SEASON ";gets(season);
int l=strlen(destination);
for (int j=0;j<=l;j++)
destination[j]=toupper(destination[j]);
int blank=20-strlen(destination);
for(int x=1;x strcat(destination," ");
destination[19]='\0';
l=strlen(season);
for (j=0;j<=l;j++)
season[j]=toupper(season[j]);
blank=20-strlen(season);
for(x=1;x strcat(season," ");
season[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(dest,destination)==0)&&(strcmp(seas,season)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares the state and cost
//input by the user and displays the data corresonding to the same.
void TRAVEL::state_cost()
{
char ch,state[20],cost[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER STATE & COST RANGE FOR WHICH ";
cout<<"INFORMATION IS TO BE DISPLAYED\n";
cout<<"STATE "; gets(state);
cout<<"COST RANGE ";gets(cost);
int l=strlen(state);
for (int j=0;j<=l;j++)
state[j]=toupper(state[j]);
int blank=20-strlen(state);
for(int x=1;x strcat(state," ");
state[19]='\0';
blank=20-strlen(cost);
for(x=1;x strcat(cost," ");
cost[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(st,state)==0)&&(strcmp(ct,cost)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\nHAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares the season and state
//input by the user and displays data corresponding to the same.
void TRAVEL::seas_state()
{
char ch,state[20],season[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER STATE & SEASON FOR WHICH INFORMATION IS TO BE DISPLAYED\n";
cout<<"STATE "; gets(state);
cout<<"SEASON ";gets(season);
int l=strlen(state);
for (int j=0;j<=l;j++)
state[j]=toupper(state[j]);
int blank=20-strlen(state);
for(int x=1;x strcat(state," ");
state[19]='\0';
l=strlen(season);
for (j=0;j<=l;j++)
season[j]=toupper(season[j]);
blank=20-strlen(season);
for(x=1;x strcat(season," ");
season[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(st,state)==0)&&(strcmp(seas,season)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\nHAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which displays the entire data of the file.
void TRAVEL::all()
{
char ch;
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"WANT TO SEE ALL RECORD Y/N"< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while(!(tfile.eof())&&(ch=='Y'))
{
i++;
abc.get_read();
cout<<"WANT TO SEE MORE RECORDS Y/N \n";
ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND";
else
cout<<"\nHAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares state input by the user and
//displays data corresponding to same.
void TRAVEL::get_state(char tt[20])
{
char ch,state[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER STATE FOR WHICH INFORMATION IS TO BE DISPLAYED\n";
gets(state);
int l= strlen(state);
for (int j=0;j<=l;j++)
state[j]=toupper(state[j]);
int blank=20-strlen(state);
for(int x=1;x strcat(state," ");
state[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(st,state)==0)&&(strcmp(ty,tt)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares attractions
//input by the user and displays data corresponding to same.
void TRAVEL::get_attract(char tt[20])
{
char ch,attraction[20],att[20];
int i=0,j=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER ATTRACTION/NAME OF TEMPLE OR MOSQUE/NAME OF GOD/FESTIVALS";
cout<<"/FORTS AND PALACES FOR WHICH INFORMATION IS TO BE DISPLAYED\n";
gets(attraction);
int l=strlen(attraction);
for (j=0;j<=l;j++)
attraction[j]=toupper(attraction[j]);
int blank=20-strlen(attraction);
for(int x=1;x<=blank;x++)
strcat(attraction," ");
attraction[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
for (j=0;j<5;j++)
{
strcpy(att,attract.name[j]);
if ((strcmp(att,attraction)==0)&&(strcmp(ty,tt)==0))
{
abc.get_read();
i++;
}
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if (i==0)
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares type
//chosen by the user and displays all data for the same.
void TRAVEL::get_all(char tt[20])
{
char ch;
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"WANT ALL DESTINATIONS TO BE DISPLAYED Y/N \n"< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if (strcmp(ty,tt)==0)
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if (i==0)
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares cost range input by the
//user and displays data corresponding to the same.
void TRAVEL::get_cost(char tt[20])
{
char ch,cost[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER COST RANGE FOR WHICH INFORMATION IS TO BE DISPLAYED\n";
gets(cost);
int l=strlen(cost);
for (i=0;i<=l;i++)
strcat(cost," ");
cost[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(ct,cost)==0)&&(strcmp(ty,tt)==0))
{
abc.get_read();
i++;
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if ((i==0)&&(ch=='Y'))
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares season input by the user
//and displays data corresponding to the same.
void TRAVEL::get_season(char tt[20])
{
char ch,season[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER SEASON SUCH AS OCTOBER TO NOVEMBER FOR WHICH INFORMATION";
cout<<"IS TO BE DISPLAYED \n";
gets(season);
int l=strlen(season);
for(int j=0;j<=l;j++)
season[j]=toupper(season[j]);
int blank=20-strlen(season);
for(int x=1;x strcat(season," ");
season[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(seas,season)==0)&&(strcmp(ty,tt)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if (i==0)
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares destination input by the
//user and displays data corresponding to that.
void TRAVEL::get_dest(char tt[20])
{
char ch,destination[20];
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER DESTINATION FOR WHICH INFORMATION IS TO BE DISPLAYED \n";
gets(destination);
int l=strlen(destination);
for(int j=0;j<=l;j++)
destination[j]=toupper(destination[j]);
int blank=20-strlen(destination);
for (int x=1;x strcat(destination," ");
destination[19]='\0';
cout<<"WANT TO FIND RECORD FOR "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if ((strcmp(dest,destination)==0)&&(strcmp(ty,tt)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if (i==0)
cout<<"\n !!!NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//member function of class TRAVEL which compares alphabet input by the user
//and displays data starting from same.
void TRAVEL::get_alpha(char tt[20])
{
char ch,alpha;
int i=0;
fstream tfile("tourism.dat",ios::binary|ios::in|ios::out);
tfile.seekg(0,ios::beg);
cout<<"ENTER ALPHABET FOR WHICH INFORMATION IS TO BE DISPLAYED \n";
alpha=toupper(getche());
cout<<"\n WANT TO FIND RECORD STARTING FROM "< ch=toupper(getch());
tfile.read((char*)&abc,sizeof(TRAVEL));
while (!(tfile.eof())&&(ch=='Y'))
{
if((alpha==dest[0])&&(strcmp(ty,tt)==0))
{
i++;
abc.get_read();
}
tfile.read((char*)&abc,sizeof(TRAVEL));
}
tfile.close();
if (i==0)
cout<<"\n NO RECORD FOUND FOR "< else
cout<<"\n HAVE A GOOD DAY \n";
wait();
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE HILL STATIONS.
void hill()
{
int ok,blank,y;
char type[20]={"HILL STATION" };
blank=20-strlen(type);
for(int i=1;i<=blank;i++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for (y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout<<"\t\t\tENTER CHOICE & PRESS ENTER \t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION----> 1 \t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY-----> 2 \t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET--> 3 \t\t\t\t";
cout<<"\t\t\tCOST RANGE-------------> 4 \t\t\t\t";
cout<<"\t\t\tSEASON-----------------> 5 \t\t\t\t";
cout<<"\t\t\tALL HILL STATIONS------> 6 \t\t\t\t";
cout<<"\t\t\tPARTICULAR ATTRACTION--> 7 \t\t\t\t";
cout<<"\t\t\tEXIT-------------------> 8 \t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for (y=1;y<12;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout << "\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1: abc.get_dest(type);
break;
case 2: abc.get_state(type);
break;
case 3: abc.get_alpha(type);
break;
case 4: abc.get_cost(type);
break;
case 5: abc.get_season(type);
break;
case 6: abc.get_all(type);
break;
case 7: abc.get_attract(type);
break;
case 8: break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=8);
}
// FUNCTION TO BE CALLED WHEN USER CHOOSES TO SEE SOUTHERN DESTINATIONS.
void south()
{
int ok,y;
char type[20]={"SOUTH"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout<<"\t ENTER CHOICE & PRESS ENTER\t\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t NAME OF DESTINATION-----------> 1\t\t\t\t";
cout<<"\t STATE WISE DISPLAY------------> 2\t\t\t\t";
cout<<"\t A PARTICULAR ALPHABET---------> 3\t\t\t\t";
cout<<"\t COST RANGE--------------------> 4\t\t\t\t";
cout<<"\t SEASON------------------------> 5\t\t\t\t";
cout<<"\t ALL SOUTHERN DESTINATIONS-----> 6\t\t\t\t";
cout<<"\t FESTIVALS OF SOUTH------------> 7\t\t\t\t";
cout<<"\t EXIT--------------------------> 8\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<12;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t Enter choice : ";
cin>>ok;
switch(ok)
{
case 1: abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_season(type);
break;
case 6:abc.get_all(type);
break;
case 7:abc.get_attract(type);
break;
case 8: break;
default:cout<<" INVALID CHOICE \n";delay(1500);break;
}
}
while(ok!=8);
}
//FUNCTION TO BE CALLED WHEN USER CHOOSES TO SEE RELIGIOUS PLACES.
void religion()
{
int ok,y;
char type[20]={"RELIGIOUS"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout<<"\t\t\tENTER CHOICE AND PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION----> 1\t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY-----> 2\t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET--> 3\t\t\t\t";
cout<<"\t\t\tCOST RANGE-------------> 4\t\t\t\t";
cout<<"\t\t\tSEASON-----------------> 5\t\t\t\t";
cout<<"\t\t\tALL RELIGIOUS PLACES---> 6\t\t\t\t";
cout<<"\t\t\tNAME OF GOD------------> 7\t\t\t\t";
cout<<"\t\t\tNAME OF TEMPLE/MOSQUE--> 8\t\t\t\t";
cout<<"\t\t\tEXIT-------------------> 9\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<12;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_season(type);
break;
case 6:abc.get_all(type);
break;
case 7:abc.get_attract(type);
break;
case 8:abc.get_attract(type);
break;
case 9: break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=9);
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE SEA BEACHES.
void seas()
{
int ok,y;
char type[20]={"BEACH"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION----> 1\t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY-----> 2\t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET--> 3\t\t\t\t";
cout<<"\t\t\tCOST RANGE-------------> 4\t\t\t\t";
cout<<"\t\t\tSEASON-----------------> 5\t\t\t\t";
cout<<"\t\t\tALL BEACHES------------> 6\t\t\t\t";
cout<<"\t\t\tPARTICULAR ATTRACTION--> 7\t\t\t\t";
cout<<"\t\t\tEXIT-------------------> 8\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<11;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout <<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_season(type);
break;
case 6:abc.get_all(type);
break;
case 7:abc.get_attract(type);
break;
case 8: break;
default:cout<<"invalid choice \n"; delay(1500); break;
}
}
while(ok!=8);
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE WILD LIFE SANCTURIES.
void sancturies()
{
int ok,y;
char type[20]={"SANCTURIES"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;
cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION---------> 1\t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY----------> 2\t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET-------> 3\t\t\t\t";
cout<<"\t\t\tCOST RANGE------------------> 4\t\t\t\t";
cout<<"\t\t\tSEASON----------------------> 5\t\t\t\t";
cout<<"\t\t\tALL WILD LIFE SANCTURIES----> 6\t\t\t\t";
cout<<"\t\t\tPARTICULAR ATTRACTION-------> 7\t\t\t\t";
cout<<"\t\t\tEXIT------------------------> 8\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<11;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_season(type);
break;
case 6:abc.get_all(type);
break;
case 7:abc.get_attract(type);
break;
case 8: break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=8);
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE LIST OF SHOPPING CENTRES.
void shopping()
{
int ok,y;
char type[20]={"SHOPPING"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<8;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION---------> 1\t\t\t\t";
cout<<"\t\t\tALL SHOPPING CENTRES--------> 2\t\t\t\t";
cout<<"\t\t\tPARTICULAR ATTRACTION-------> 3\t\t\t\t";
cout<<"\t\t\tEXIT------------------------> 4\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------\n";
for(y=1;y<11;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_all(type);
break;
case 3:abc.get_attract(type);
break;
case 4:
break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=4);
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE HISTORICAL PLACES.
void historical()
{
int ok,y;
char type[20]={"HISTORICAL"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION---------> 1\t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY----------> 2\t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET-------> 3\t\t\t\t";
cout<<"\t\t\tCOST RANGE------------------> 4\t\t\t\t";
cout<<"\t\t\tALL HISTORICAL PLACES-------> 5\t\t\t\t";
cout<<"\t\t\tFORTS AND PALACES-----------> 6\t\t\t\t";
cout<<"\t\t\tEXIT------------------------> 7\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<12;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_all(type);
break;
case 6:abc.get_attract(type);
break;
case 7:
break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=7);
}
//FUNCTION TO BE CALLED WHEN USER WANTS TO SEE EASTERN PLACES.
void east()
{
int ok,y;
char type[20]={"EAST"};
int blank=20-strlen(type);
for (int l=1;l<=blank;l++)
strcat(type," ");
type[19]='\0';
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tNAME OF DESTINATION---------> 1\t\t\t\t";
cout<<"\t\t\tSTATE WISE DISPLAY----------> 2\t\t\t\t";
cout<<"\t\t\tA PARTICULAR ALPHABET-------> 3\t\t\t\t";
cout<<"\t\t\tCOST RANGE------------------> 4\t\t\t\t";
cout<<"\t\t\tSEASON----------------------> 5\t\t\t\t";
cout<<"\t\t\tALL EASTERN DESTINATIONS----> 6\t\t\t\t";
cout<<"\t\t\tPARTICULAR ATTRACTION-------> 7\t\t\t\t";
cout<<"\t\t\tEXIT------------------------> 8\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<12;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.get_dest(type);
break;
case 2:abc.get_state(type);
break;
case 3:abc.get_alpha(type);
break;
case 4:abc.get_cost(type);
break;
case 5:abc.get_season(type);
break;
case 6:abc.get_all(type);
break;
case 7:abc.get_attract(type);
break;
case 8: break;
default:cout<<"invalid choice \n";delay(1500);break;
}
}
while(ok!=8);
}
//FUNCTION TO BE CALLED WHEN USER WANTS EXTRA INFORMATION FOR ALL TYPE OF
//PLACES .
void extra(void)
{
int ok,y;
do
{
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tENTER CHOICE & PRESS ENTER\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\tDESTINATION & SEASON------> 1\t\t\t\t";
cout<<"\t\t\tSTATE & SEASON ------> 2\t\t\t\t";
cout<<"\t\t\tSTATE & COST ------> 3\t\t\t\t";
cout<<"\t\t\tALL ------> 4\t\t\t\t";
cout<<"\t\t\tEXIT ------> 5\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<14;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\tEnter choice : ";
cin>>ok;
switch(ok)
{
case 1:abc.dest_seas();
break;
case 2:abc.seas_state();
break;
case 3:abc.state_cost();
break;
case 4:abc.all();
break;
case 5: break;
default:cout<<"Invalid Choice \n";delay(1500);break;
}
}
while(ok!=5);
}

// FUNCTION FOR THE FIRST SCREEN.
void starter()
{
clearviewport();
char s;

while(!kbhit())
{

for(int i=0;i<3;i++)
{
circle(20,20,40+5*i);
circle(618,20,40+5*i);
circle(20,458,40+5*i);
circle(618,458,40+5*i);
circle(320,20,40+5*i);
circle(320,458,40+5*i);
circle(20,240,40+5*i);
circle(618,240,40+5*i);
delay(100);
}
for(i=1;i<5;i++)
{
line(5*i-5,0,5*i-5,479);
line(0,5*i-5,639,5*i-5);
line(639-5*(i-1),0,639-5*(i-1),479);
line(0,484-5*i,639,484-5*i);
delay(100);
}

settextjustify(CENTER_TEXT,CENTER_TEXT);
for(i=2;i<=9;i++)
{
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
setcolor(i+6);
outtextxy(320,65+10*i,"TOURS & TRAVELS ");
delay(100);

setcolor(BLACK);
outtextxy(320,65+10*i,"TOURS & TRAVELS ");
setcolor(i+6);

settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(320,240,"Project made by - ");
settextstyle(SMALL_FONT,HORIZ_DIR,6);
setcolor(2);
outtextxy(320,285,"Prashasti Mishra & Anuradha Dalmia ");
setcolor(i+6);

settextstyle(SMALL_FONT,HORIZ_DIR,6);
outtextxy(320,325,"A Complete Tours & Travels Management Package");
settextstyle(SMALL_FONT,HORIZ_DIR,6);
setcolor(CYAN);

outtextxy(450,380,"Press any key to continue..... ");

}
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
setcolor(i+5);
outtextxy(320,65+10*i,"TOURS & TRAVELS ");
delay(500);
clearviewport();
delay(100);
setcolor(WHITE);

}

//if((s=getche())>=0);
settextjustify(LEFT_TEXT,TOP_TEXT);
settextstyle(DEFAULT_FONT,HORIZ_DIR,5);
} // END OF STARTER FUNCTION


void last(void)
{
float y1,a,b,i,axisx,axisy;
int c,z=1;
long float x;
int gdriver = DETECT, gmode, errorcode;
clrscr();
initgraph(&gdriver, &gmode, "c:\\bgi");
// setbkcolor(BLACK);
for(i=0;i<=2;i+=.5)
{
for (x=-12.3662/2;x<=12.3662/2;x+=0.01745)
{
a=-i*exp(-(x*x));
b=100*a;
c=b;
y1=p+c;
putpixel(318+x*100,y1,z);
delay(1);
}
z++;
}
axisx=37;axisy=12;
for(i=.5;i<=2;i+=.5)
{
gotoxy(axisx,axisy);
axisy-=3;
sound(750*i);
delay(200);
nosound();
}
axisx=2;axisy=17;
for(i=-3;i<=3;i++)
{
gotoxy(axisx,axisy);
axisx+=12;
sound(750*i);
delay(200);
nosound();
}
settextjustify(CENTER_TEXT,CENTER_TEXT);
for(i=2;i<=9;i++)
{
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
setcolor(i+6);
outtextxy(320,210+25*i,"THANK YOU ");
}
getch();
} // END OF LAST FUNCTION.


//MAIN BODY OF THE PROGRAM
void main (void)
{
int ok,y;
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"");

starter();
do
{
initgraph(&gdriver,&gmode,"");
graphresult();
clrscr();
clearviewport();
setbkcolor(BLUE);
for(y=1;y<5;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\t\tENTER CHOICE\t\t\t\t\t";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
cout<<"\t\t\t HILL STATION ------> 1\n";
cout<<"\t\t\t SOUTHERN DESTINATION ------> 2\n";
cout<<"\t\t\t RELIGOUS PLACE ------> 3\n";
cout<<"\t\t\t SEA SIDE ------> 4\n";
cout<<"\t\t\t WILD LIFE SANTURIES ------> 5\n";
cout<<"\t\t\t SHOPPING CENTRES ------> 6\n";
cout<<"\t\t\t HISTORICAL PLACES ------> 7\n";
cout<<"\t\t\t EXPLORE EAST ------> 8\n";
cout<<"\t\t\t PROGRAMMER ------> 9\n";
cout<<"\t\t\t EXTRA ------> 10\n";
cout<<"\t\t\t EXIT ------> 11\n";
cout<<"--------------------------------------------------------";
cout<<"------------------------";
for(y=1;y<10;y++)
cout << "\t\t\t\t\t\t\t\t\t " << endl;

cout<<"\t\t\t Enter choice : ";
cin>>ok;
switch(ok)
{
case 1:hill();
break;
case 2:south();
break;
case 3:religion();
break;
case 4:seas();
break;
case 5:sancturies();
break;
case 6:shopping();
break;
case 7:historical();
break;
case 8:east();
break;
case 9:pass();
break;
case 10:extra();
break;
case 11:
break;
default:cout<<"INVALID CHOICE \n";delay(1500);break;
}
closegraph();
}
while (ok!=11);
last();
}

2006-11-19 22:42:45 · 5 answers · asked by Anonymous in Computers & Internet Programming & Design

5 answers

Thats a lot of code there! Is there any chance you could narrow it down a little? Try testing each function individually - this might give you more of an idea where the problem lies.

Rawlyn.

2006-11-19 22:51:10 · answer #1 · answered by Anonymous · 0 0

main(...) requires that it return an int at a minimum. the arguments can be void or int argc, char * argv[] or int argc, char * argv[], char * envp[] as for getch(), it will get a character, but unless you assign its outout to a variable, you are throwing away its output. so I suggest int ch=getch(); as for clrscr(), it is only available in conio.h, not stdio.h, and conio.h essentially uses no buffers I think, while stdio.h uses buffers and under some conditions may need to be flushed with fflush(stdout). so they are totally different and usually shouldn't be mixed. not good programming. either stick with conio.h or stdio.h or iostream & fstream but don't mix.

2016-03-29 02:30:26 · answer #2 · answered by ? 4 · 0 0

You send 1500+ lines of Borland-specific DOS code fragments (it seems, it is from some old article...) and want somebody to make from it working program?!

2006-11-19 23:59:54 · answer #3 · answered by alakit013 5 · 0 0

Dude I tried to comple this, and got over 400 syntax errors, please check if there are any syntax errors in your complier, and narrow this problem down, and comment the code!!

2006-11-20 10:31:16 · answer #4 · answered by D 4 · 0 0

Will u care to give the details....as in what error is it showin??

2006-11-19 22:47:48 · answer #5 · answered by jigvesh b 2 · 0 0

fedest.com, questions and answers