#include<iostream.h>

#include<graphics.h>

#include<conio.h>

#include<string.h>

#include<process.h>

#include<math.h>

#include<stdio.h>

#include<dos.h>



void wel(),gd(),bdr(),crux(),sparks(),ext(),pswrd();

void chkmn(),adm(),gst(),edtmn(),delmn(),srch();

void dtin(int),dtdis(int),dslst(),edit(),del(),src(),srn();



void chk(char &demo);

struct cust

{

       char nm[25],to[20],frm[20],mod[20],add[50];

       long pn,mn;

       int na,nc,cd;

};

cust c[5];

char usnm[10];

char ad[7]="Prachi0";


                                                              1
int csn=0;

int srr,ssr,dc,ec;



void swap(char *,char *);

void date();

int leap(int);

struct dat

{

       int d,m,y,lp;

};

dat dt;

int md[12]={31,28,31,30,31,30,31,31,30,31,30,31};



void time();

void distm();

void tmchg();

struct tim

{

       int h,m,s,t;

       char tt[5],x[5];

};

tim tm;

char ta[5]="A.M.0",tb[5]="P.M.0";


                                                    2
void main()

{

     clrscr();

     //wel();

     adm();

     getch();



}

void chkmn()

{

     int g=0;

     clrscr();

     sparks();

     bdr();

     gotoxy(10,40);

     cout<<"Press ESC to Exit the Program ";

     if(kbhit()==8)

     {

              gotoxy(15,45);

              cout<<"Terminating Program..........";

              delay(1000);

              exit(0);


                                                       3
}

     gotoxy(15,30);

     textcolor(LIGHTRED);

     cprintf("Enter your Name : ");

     gets(usnm);

     gotoxy(5,43);

     g=strcmpi(usnm,ad);

     if(g==0)

     {

             pswrd();

     }

     if(g!=0)

     {

             gst();

     }

}

void adm()

{

     gotoxy(6,6);

     int ch;



     while(1)

     {


                                      4
clrscr();

          gd();

          gotoxy(20,6);

          textcolor(LIGHTBLUE);

          cprintf("ADMINISTRATER MENU");

          gotoxy(8,9);

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~"

                  <<"nnt1. Displays the list & details of all Travellers."

                  <<"nnt2. Go to the Guest Menu."

                  <<"nnt3. Searches the Traveller."

                  <<"nnt4. Edits the Traveller's Details."

                  <<"nnt5. Deletes the Traveller's Details."

                  <<"nnt6. Go to User Menu"

                  <<"nnt7. Exits the Program."

                  <<"nnntt Your choice : ";

          cin>>ch;

          switch(ch)

          {

                  case 1 :

                         dslst();

                         break;

                  case 2 :

                         gst();

                                                                                5
break;

                       case 3 :

                             srch();

                             break;

                       case 4 :

                             edtmn();

                             break;

                       case 5 :

                             delmn();

                             break;

                       case 6 :

                             chkmn();

                             break;

                       case 7 :

                             exit(0);

                       default :

                             cout<<" Wrong choice entered !!!!! " ;

                 }

                 getch();

        }

    //getch();

}

void srch()


                                                                      6
{

    int ch;



    while(1)

    {

          clrscr();

          cout<<"nnttSEARCH MENU"

                 <<"nnnt1. Search by Code."

                 <<"nnt2. Search by Name."

                 <<"nnt3. Go back to Administrator Menu."

                 <<"nnt4. Exit the Program."

                 <<"nnnttYour choice : ";

          cin>>ch;

          switch(ch)

          {

                 case 1 :

                       src();

                       break;

                 case 2 :

                       srn();

                       break;

                 case 3 :

                       adm();


                                                               7
break;

                     case 4 :

                            exit(0);

                     default :

                            cout<<"nnntt Wrong choice entered !!!!! " ;

             }

      }//getch();

      //getch();

}

void gst()

{

      int ch,flag=0;

      while(1)

      {

             clrscr();

             gd();

             gotoxy(20,6);

             textcolor(LIGHTBLUE);

             cprintf("GUEST MENU");

             gotoxy(8,9);


      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~"

                     <<"nnt1. Accepts the details."

                                                                               8
<<"nnt2. Displays the details."

      <<"nnt3. Go to User Menu."

      <<"nnt4. Exits the Program"

      <<"nnntt Your choice : ";

cin>>ch;

switch(ch)

{

      case 1 :

             csn++;

             dtin(csn);

             flag=1;

             break;

      case 2 :

             if(flag)

             {

                    dtdis(csn-1);

                    break;

             }

             else

             {

                    cout<<"nnnttEnter choice 1 first !!!!!";

                    break;

             }


                                                                    9
case 3 :

                        chkmn();

                        break;



                  case 4 :

                        exit(0);

                  default :

                        cout<<"nnnt Wrong choice entered !!!!! " ;

           }

           if(ch==10)

                  adm();

           getch();

     }

}



void delmn()

{

     int ch;

     while(1)

     {

           clrscr();

           gotoxy(20,8);

           cout<<" DELETE MENU ";


                                                                         10
gotoxy(8,10);


      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~"

                 <<"nntSearches & Deletes"

                 <<"nntt1. By Code "

                 <<"nntt2. By Name"

                 <<"nnt3. Go to Administrator Menu."

                 <<"nnt4. Exits the Program"

                 <<"nnntt Your choice : ";

           cin>>ch;

           switch(ch)

           {

                 case 1 :

                        dc=1;

                        del();

                        break;

                 case 2 :

                        dc=2;

                        del();

                        break;

                 case 3 :

                        adm();

                        break;

                                                                11
case 4 :

                         exit(0);

                   default :

                         cout<<"nnnt Wrong choice entered !!!!! " ;

            }

            getch();

      }

}




void edtmn()

{

      int ch;

      while(1)

      {

            clrscr();

            gotoxy(20,8);

            cout<<" EDIT MENU ";

            gotoxy(8,10);


      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~"

                   <<"nntSearches & Edits"

                   <<"nntt1. By Code "

                                                                          12
<<"nntt2. By Name"

      <<"nnt3. Go to Administrator Menu."

      <<"nnt4. Exits the Program"

      <<"nnntt Your choice : ";

cin>>ch;

switch(ch)

{

      case 1 :

             ec=1;

             edit();

             break;

      case 2 :

             ec=2;

             edit();

             break;

      case 3 :

             adm();

             break;

      case 4 :

             exit(0);

      default :

             cout<<"nnnt Wrong choice entered !!!!! " ;

}


                                                              13
getch();

      }

}

void dtin(int l)

{

      l=l-1;

      clrscr();

      c[l].cd=2010+csn;

      textcolor(MAGENTA);

      gotoxy(20,8);

      cprintf("INPUTS TRAVELLERS DETAILS ");

      textcolor(LIGHTBLUE);

      gotoxy(18,10);

      cprintf("Customer Code. ");

      cout<<c[l].cd;

      gotoxy(7,15);

      cout<<"Name              : ";

      gets(c[l].nm);

      gotoxy(7,17);

      cout<<"From             : ";

      gets(c[l].frm);

      gotoxy(7,19);

      cout<<"Destination         : ";


                                               14
gets(c[l].to);

      gotoxy(7,21);

      cout<<"Address           : ";

      gets(c[l].add);

      gotoxy(7,23);

      cout<<"Mode of Transport : ";

      gets(c[l].mod);

      gotoxy(7,25);

      cout<<"Phone No.          : ";

      cin>>c[l].pn;

      gotoxy(7,27);

      cout<<"Mobile No.          : ";

      cin>>c[l].mn;

      gotoxy(7,29);

      cout<<"No. of adults       : ";

      cin>>c[l].na;

      gotoxy(7,31);

      cout<<"No. of children      : ";

      cin>>c[l].nc;

}

void dtdis(int l)

{

      clrscr();


                                         15
textcolor(MAGENTA);

gotoxy(20,8);

cprintf("TRAVELLER'S DETAILS ");

textcolor(LIGHTBLUE);

gotoxy(18,10);

cprintf("Customer Code. ");

cout<<c[l].cd;

gotoxy(7,15);

cout<<"Name             : ";

puts(c[l].nm);

gotoxy(7,17);

cout<<"From           : ";

puts(c[l].frm);

gotoxy(7,19);

cout<<"Destination        : ";

puts(c[l].to);

gotoxy(7,21);

cout<<"Address          : ";

puts(c[l].add);

gotoxy(7,23);

cout<<"Mode of Transport : ";

puts(c[l].mod);

gotoxy(7,25);


                                   16
cout<<"Phone No.            :"

               <<c[l].pn;

      gotoxy(7,27);

      cout<<"Mobile No.           :"

               <<c[l].mn;

      gotoxy(7,29);

      cout<<"No. of adults        :"

               <<c[l].na;

      gotoxy(7,31);

      cout<<"No. of children        :"

               <<c[l].nc;

}

void dslst()

{

      clrscr();

      int h=10;

      gotoxy(20,7);

      cout<<"TRAVELLER'S LIST"

               <<"nn       Code"

               <<"          Name"

               <<"          Mode of Transport";

      for(int i=0;i<csn;i++,h++,h++)

      {


                                                  17
gotoxy(8,h);

             cout<<c[i].cd;

             gotoxy(20,h);

             puts(c[i].nm);

             gotoxy(35,h);

             puts(c[i].mod);

      }

      adm();

}

void src()

{

      int sc,flag=0;

      cout<<"nnttEnter the Code of the Traveller : ";

      cin>>sc;

      for(int i=0;i<csn;i++)

      {

             if(sc==c[i].cd)

             {

                   flag=1;

                   srr=i;

                   ssr=1;

                   dtdis(srr);

             }


                                                            18
}

                 if(flag==0)

                 {

                        cout<<"nntEntered code doesn't exist in the records
!!!";

                        ssr=0;

                 }

        getch();



}

void srn()

{

        char sn[25];

        int x,flag=0,h=0;

        cout<<"nnntEnter the Name of the Traveller : ";

        gets(sn);

        for(int i=0;i<csn;i++)

        {

                 x=strcmpi(c[i].nm,sn);

                 h=1;

            //   cout<<endl<<x<<endl;

                 if(x==0)

                 {

                        flag=1;

                                                                                 19
srr=i;

                        ssr=1;

                        dtdis(srr);

               }



        }

        if((flag==0&&x!=0)||h==0)

        {

               cout<<"nnntEntered Traveller doesn't exist in the records
!!!";

               ssr=0;

        }

        getch();



}

void del()

{

        clrscr();

        if(dc==1);

        {

               src();

        }

        if(dc==2);

        {

                                                                               20
srn();

      }

      if(ssr==1)

      {

            for(int i=srr;i<csn;i++)

            {

                     c[i].cd=c[i+1].cd;

                     strcpy(c[i].nm,c[i+1].nm);

                     strcpy(c[i].frm,c[i+1].frm);

                     strcpy(c[i].to,c[i+1].to);

                     strcpy(c[i].add,c[i+1].add);

                     strcpy(c[i].mod,c[i+1].mod);

                     c[i].pn=c[i+1].pn;

                     c[i].mn=c[i+1].mn;

                     c[i].na=c[i+1].na;

                     c[i].nc=c[i+1].nc;

            }

            csn--;

             cout<<"nnt Entered traveller's details have been deleted
sucessfully !!!";

      }

      if(ssr==0)

      {

            cout<<"nnntEntered traveller's details not Deleted !!!";

                                                                           21
}

      getch();

      delmn();

}

void edit()

{

      int e;

      clrscr();

      if(ec==1);

      {

               src();

      }

      if(ec==2);

      {

               srn();

      }

      if(ssr==1)

      {

               clrscr();

               textcolor(MAGENTA);

               gotoxy(20,8);

               cprintf("EDITS TRAVELLERS DETAILS ");

               textcolor(LIGHTBLUE);


                                                       22
gotoxy(18,10);

cprintf("Customer Code. ");

cout<<c[srr].cd;

gotoxy(7,15);

cout<<"Name               : ";

puts(c[srr].nm);

e=getch();

if(e==8)

{

      gotoxy(29,15);

      cout<<"                    ";

      gotoxy(29,15);

      gets(c[srr].nm);

}

gotoxy(7,17);

cout<<"From              : ";

puts(c[srr].frm);

e=getch();

if(e==8)

{

      gotoxy(29,17);

      cout<<"                    ";

      gotoxy(29,17);


                                      23
gets(c[srr].frm);

}

gotoxy(7,19);

cout<<"Destination         : ";

puts(c[srr].to);

e=getch();

if(e==8)

{

      gotoxy(29,19);

      cout<<"                     ";

      gotoxy(29,19);

      gets(c[srr].to);

}

gotoxy(7,21);

cout<<"Address            : ";

puts(c[srr].add);

e=getch();

if(e==8)

{

      gotoxy(29,21);

      cout<<"                     ";

      gotoxy(29,21);

      gets(c[srr].add);


                                       24
}

gotoxy(7,23);

cout<<"Mode of Transport : ";

puts(c[srr].mod);

e=getch();

if(e==8)

{

      gotoxy(29,23);

      cout<<"                    ";

      gotoxy(29,23);

      gets(c[srr].mod);

}

gotoxy(7,25);

cout<<"Phone No.          : ";

cout<<c[srr].pn;

e=getch();

if(e==8)

{

      gotoxy(29,25);

      cout<<"                    ";

      gotoxy(29,25);

      cin>>c[srr].pn;

}


                                      25
gotoxy(7,27);

cout<<"Mobile No.       : ";

cout<<c[srr].mn;

e=getch();

if(e==8)

{

      gotoxy(29,27);

      cout<<"                  ";

      gotoxy(29,27);

      cin>>c[srr].mn;

}

gotoxy(7,29);

cout<<"No. of adults    : ";

cout<<c[srr].na;

e=getch();

if(e==8)

{

      gotoxy(29,29);

      cout<<"                       ";

      gotoxy(29,29);

      cin>>c[srr].na;

}

gotoxy(7,31);


                                         26
cout<<"No. of children    : ";

             cout<<c[srr].nc;

             e=getch();

             if(e==8)

             {

                   gotoxy(29,31);

                   cout<<"                           ";

                   gotoxy(29,31);

                   cin>>c[srr].nc;

             }

             cout<<"nnt Entered traveller's details have been edited
sucessfully !!!";

      }

      if(ssr==0)

      {

                   cout<<"nnntEntered traveller's details not Edited !!!";

      }

      getch();

      edtmn();

}

void pswrd()

{

      clrscr();



                                                                             27
gd();

     char pass[10],abs[10]="money";

     char pp[3]={1,2,'0'};

     int h,i,f,l;



         //   gotoxy(5,5);

     textcolor(LIGHTRED);

         //   cprintf("Enter the username : ");

         //   gets(us);




     for(int s=1;s<=3;s++)

     {

              f=0;

              gotoxy(5,8);

                  //   textcolor(LIGHTBLUE);

              cprintf("Enter the Password :       ");

x:

              h=26;

              for(i=0;i>=0;i++,h++)

              {

s:

                       gotoxy(h,8);


                                                        28
pass[i]=getch();

    //b++;



    if(pass[i]==13)

    {

          break;

    }



    if(pass[i]==8)

    {

          h--;

          if(h<26)

          {

                 goto x;

          }

          gotoxy(h,8);

          cout<<" ";

          i--;

          pass[i]=NULL;

          goto s;

    }

    cout<<"*";

}


                           29
pass[i]=NULL;

        l=strlen(pass);



        cout<<"nn";



        f=strcmp(pass,abs);



        if(f==0)

        {

              textcolor(LIGHTBLUE);

              cprintf("nnn             Entered correct password !!!!!!!!
n");

              gotoxy(3,16);

              textcolor(YELLOW);

              cprintf("nProgram in process please wait....nnnn");

              for(int j=0,k=0;j<50;k=k+2,j++)

              {

                     gotoxy(5,20);

                     textcolor(GREEN);

                     cprintf(" Done ");

                     cout<<k+2<<" % ";

                     gotoxy(10+j,22);

                     textcolor(MAGENTA);

                                                                              30
cprintf(pp);

                              delay(200);

                     }

                     adm();

                     break;

              }

              else if(f!=0)

              {

                     textcolor(CYAN);

                     cprintf("nnn Wrong password entered !!!! Re-enter
Password......");

                     //b++;

                     for( i=0;i<l;i++,h--)

                     {

                              pass[i]=NULL;

                              gotoxy(h-1,8);

                              cout<<" ";

                     }

                     if(s==3)

                     {

                              gotoxy(2,18);

                              textcolor(RED);

                              cprintf("You have entered the password wrong 3
times.. ");

                                                                               31
gotoxy(2,20);

                        cprintf("Now your program has been blocked !!!!");

                   }

               }

      }

      cout<<"nnnn";

      getch();



}

void wel()

{

      clrscr();

      textcolor(YELLOW);

      gotoxy(28,15);

      cprintf("WELCOME TO SPARKS TRAVELS ");

      gotoxy(40,35);

      textcolor(LIGHTBLUE);

      cprintf("Developed By - ");

      textcolor(BLUE+BLINK);

      cprintf("Parimal Chakole,DVS Srihari,Naina Ghate");

      gd();

      ext();

      delay(1000);


                                                                         32
chkmn();

}

void gd()

{

      //textbackground(WHITE);

      textcolor(RED);

      for(int i=1;i<80;i++)   //outer hori.

      {

            gotoxy(i,1);

            cprintf("*");

            gotoxy(i,50);

            cprintf("*");

      }

      textcolor(GREEN+BLINK);

      for(i=3;i<78;i++)       // inner hori.

      {

            gotoxy(i,2);

            cprintf(".");

            gotoxy(i,48);

            cprintf(".");



      }

      textcolor(RED);


                                               33
for(int j=1;j<50;j++)    // outer vert.

      {

             gotoxy(1,j);

             cprintf("*");

             gotoxy(80,j);

             cprintf("*");

      }

      textcolor(GREEN+BLINK);

      for(j=2;j<48;j++)       // inner vert.

      {

             gotoxy(3,j);

             cprintf(".");

             gotoxy(78,j);

             cprintf(".");

      }

      gotoxy(5,5);

}

void bdr()

{

      textcolor(GREEN+BLINK);

      for(int i=1;i<80;i++)   //outer hori.

      {

             gotoxy(i,1);


                                                34
cprintf("@");

      gotoxy(i,50);

      cprintf("@");

}

textcolor(RED);

for(i=3;i<78;i++)       // inner hori.

{

      gotoxy(i,2);

      cprintf(".");

      gotoxy(i,48);

      cprintf(".");



}

textcolor(GREEN+BLINK);

for(int j=1;j<50;j++)    // outer vert.

{

      gotoxy(1,j);

      cprintf("@");

      gotoxy(80,j);

      cprintf("@");

}

textcolor(RED);

for(j=2;j<48;j++)       // inner vert.


                                          35
{

               gotoxy(3,j);

               cprintf(".");

               gotoxy(78,j);

               cprintf(".");

      }

      gotoxy(5,5);

}

void crux()

{

          //   clrscr();

      textcolor(RED+BLUE);

      cprintf("                $$$$ $$$$ $ $ $ $"); cout<<endl;

      cprintf("               $   $ $ $ $ $ $ ");        cout<<endl;

      cprintf("               $   $$$$ $ $ $$ ");        cout<<endl;

      cprintf("               $   $ $$ $ $ $ $ ");       cout<<endl;

      cprintf("                $$$$ $ $ $$$ $ $"); cout<<"nnnn";



      cprintf("       $$$$$$$ $$$$ $$$ $ $ $$$$$ $             $$$$"); cout<<endl;

      cprintf("            $ $ $$ $$ $$       $       $$ ");    cout<<endl;

      cprintf("            $ $$$$ $$$$$ $ $ $$$ $         $$$ ");      cout<<endl;

      cprintf("            $ $ $$ $ $ $ $ $       $      $$"); cout<<endl;

      cprintf("            $ $ $ $ $ $ $$$$$ $$$$$ $$$$ ");


                                                                                     36
}

void sparks()

{

        //     clrscr();

      textcolor(RED+BLUE);

      gotoxy(1,7);

      cprintf("              $$$$ $$$$ $$$ $$$$ $ $ $$$$ "); cout<<endl;

      cprintf("             $$ $ $ $ $ $ $ $ $ $$ "); cout<<endl;

      cprintf("              $$$ $$$$ $$$$$ $$$$ $$$ $$$ ");cout<<endl;

      cprintf("               $$ $   $ $ $ $$ $ $   $$ "); cout<<endl;

      cprintf("             $$$$ $    $ $ $ $ $ $ $$$$ "); cout<<"nnnn";



     cprintf("             $$$$$$$ $$$$ $$$ $ $ $$$$$ $       $$$$");
cout<<endl;

      cprintf("             $ $ $$ $$ $$       $    $$ ");      cout<<endl;

      cprintf("             $ $$$$ $$$$$ $ $ $$$ $       $$$ "); cout<<endl;

      cprintf("             $ $ $$ $ $ $ $ $    $     $$");     cout<<endl;

      cprintf("             $ $ $ $ $ $ $$$$$ $$$$$ $$$$ ");

}



void ext()

{

      int k;

      gotoxy(5,43);

                                                                               37
cout<<"Press ESC to Exit the Program ";

      k=getch();

      if(k==27)

      {

              gotoxy(20,45);

              cout<<"Terminating Program..........";

              delay(1000);

              exit(0);

      }

}



void date()

{

      cout<<"Enter the year : ";

      cin>>dt.y;

      while(dt.y<=999||dt.y>1)

      {

              cout<<"Invalid year re-enter : ";

              cin>>dt.y;

      }

      dt.lp=leap(dt.y);



      cout<<"Enter t ";


                                                       38
cin>>dt.m;

      while(dt.m<1||dt.m>12)

      {

             cout<<"Invalid year re-enter : ";

             cin>>dt.m;

      }



      cout<<"Enter the date : ";

      cin>>dt.d;

      while(dt.d>md[dt.m-1]||dt.d<1)

      {

             cout<<"Invalid date re-enter : ";

             cin>>dt.d;

      }



}

int leap(int x)

{

      int lp=0;

      if((x%4==0)||((x%400==0)&&(x%100==0)))

      {

             lp=1;

             md[2]=28;


                                                 39
}

      return lp;

}



void time()

{

      cout<<"Enter hours : ";

      cin>>tm.h;

      while(tm.h>12)

      {

              cout<<"Invalid hours re-enter : ";

              cin>>tm.h;

      }



      cout<<"Enter minutes : ";

      cin>>tm.m;

      while(tm.m>60)

      {

              cout<<"Invalid minutes re-enter : ";

              cin>>tm.m;

      }

      cout<<"Enter seconds : ";

      cin>>tm.s;


                                                     40
while(tm.s>60)

     {

           cout<<"Invalid seconds re-enter : ";

           cin>>tm.s;

     }

     cout<<"nIs it A.M. or P.M. ??"

           <<"nEnter 1. A.M."

           <<"nEnter 2. P.M."

           <<"nnYour choice : ";

     cin>>tm.t;

     while(tm.t!=1&&tm.t!=2)

     {

           cout<<"Invalid time re-enter : ";

           cin>>tm.t;

     }

     if(tm.t==1)

     {

           strcpy(tm.tt,ta);

//         puts(tb);

           strcpy(tm.x,tb);

     }

     if(tm.t==2)

     {


                                                  41
strcpy(tm.tt,tb);

    //          puts(ta);

                strcpy(tm.x,ta);

         }

         tm.tt[4]='0';

         tm.x[4]='0';

         distm();

         tmchg();

}



void distm()

{

         gotoxy(15,15);

         cprintf(" ");

         cout<<tm.h<<":"

                <<tm.m<<":"

                <<tm.s<<" "

                <<tm.tt;

}

void tmchg()

{

         for(int a=tm.h;a<=12;a++)

         {


                                     42
for(int b=tm.m;b<60;b++)

{

     for(int c=tm.s;c<=60;c++)

     {

           delay(1003);

      //   gotoxy(15,15);

           distm();

           tm.s++;

           if(kbhit())

           {

                  delay(500);

                  gotoxy(7,25);

                  cout<<"Time Stopped !!!!";

                  delay(1000);

                  cout<<"Terminating.......";

                  delay(2000);

           }

           if(tm.h==12&&tm.m==59&&tm.s==60)

           {

                  tm.h=1;

                  a=1;

                  tm.m=0;

                  b=0;


                                                43
tm.s=0;

                                  c=0;

                                  swap(tm.tt,tm.x);

                          }

                     }

                     tm.m++;

                     tm.s=00;

            }

            tm.h++;

            tm.m=00;

      }

}

void swap(char a[5], char b[5])

{

      char c[5];

      strcpy(c,a);

      strcpy(a,b);

      strcpy(b,c);

}




                                                      44
45
46
47
48

Travel management

  • 1.
    #include<iostream.h> #include<graphics.h> #include<conio.h> #include<string.h> #include<process.h> #include<math.h> #include<stdio.h> #include<dos.h> void wel(),gd(),bdr(),crux(),sparks(),ext(),pswrd(); void chkmn(),adm(),gst(),edtmn(),delmn(),srch(); voiddtin(int),dtdis(int),dslst(),edit(),del(),src(),srn(); void chk(char &demo); struct cust { char nm[25],to[20],frm[20],mod[20],add[50]; long pn,mn; int na,nc,cd; }; cust c[5]; char usnm[10]; char ad[7]="Prachi0"; 1
  • 2.
    int csn=0; int srr,ssr,dc,ec; voidswap(char *,char *); void date(); int leap(int); struct dat { int d,m,y,lp; }; dat dt; int md[12]={31,28,31,30,31,30,31,31,30,31,30,31}; void time(); void distm(); void tmchg(); struct tim { int h,m,s,t; char tt[5],x[5]; }; tim tm; char ta[5]="A.M.0",tb[5]="P.M.0"; 2
  • 3.
    void main() { clrscr(); //wel(); adm(); getch(); } void chkmn() { int g=0; clrscr(); sparks(); bdr(); gotoxy(10,40); cout<<"Press ESC to Exit the Program "; if(kbhit()==8) { gotoxy(15,45); cout<<"Terminating Program.........."; delay(1000); exit(0); 3
  • 4.
    } gotoxy(15,30); textcolor(LIGHTRED); cprintf("Enter your Name : "); gets(usnm); gotoxy(5,43); g=strcmpi(usnm,ad); if(g==0) { pswrd(); } if(g!=0) { gst(); } } void adm() { gotoxy(6,6); int ch; while(1) { 4
  • 5.
    clrscr(); gd(); gotoxy(20,6); textcolor(LIGHTBLUE); cprintf("ADMINISTRATER MENU"); gotoxy(8,9); cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~" <<"nnt1. Displays the list & details of all Travellers." <<"nnt2. Go to the Guest Menu." <<"nnt3. Searches the Traveller." <<"nnt4. Edits the Traveller's Details." <<"nnt5. Deletes the Traveller's Details." <<"nnt6. Go to User Menu" <<"nnt7. Exits the Program." <<"nnntt Your choice : "; cin>>ch; switch(ch) { case 1 : dslst(); break; case 2 : gst(); 5
  • 6.
    break; case 3 : srch(); break; case 4 : edtmn(); break; case 5 : delmn(); break; case 6 : chkmn(); break; case 7 : exit(0); default : cout<<" Wrong choice entered !!!!! " ; } getch(); } //getch(); } void srch() 6
  • 7.
    { int ch; while(1) { clrscr(); cout<<"nnttSEARCH MENU" <<"nnnt1. Search by Code." <<"nnt2. Search by Name." <<"nnt3. Go back to Administrator Menu." <<"nnt4. Exit the Program." <<"nnnttYour choice : "; cin>>ch; switch(ch) { case 1 : src(); break; case 2 : srn(); break; case 3 : adm(); 7
  • 8.
    break; case 4 : exit(0); default : cout<<"nnntt Wrong choice entered !!!!! " ; } }//getch(); //getch(); } void gst() { int ch,flag=0; while(1) { clrscr(); gd(); gotoxy(20,6); textcolor(LIGHTBLUE); cprintf("GUEST MENU"); gotoxy(8,9); cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~" <<"nnt1. Accepts the details." 8
  • 9.
    <<"nnt2. Displays thedetails." <<"nnt3. Go to User Menu." <<"nnt4. Exits the Program" <<"nnntt Your choice : "; cin>>ch; switch(ch) { case 1 : csn++; dtin(csn); flag=1; break; case 2 : if(flag) { dtdis(csn-1); break; } else { cout<<"nnnttEnter choice 1 first !!!!!"; break; } 9
  • 10.
    case 3 : chkmn(); break; case 4 : exit(0); default : cout<<"nnnt Wrong choice entered !!!!! " ; } if(ch==10) adm(); getch(); } } void delmn() { int ch; while(1) { clrscr(); gotoxy(20,8); cout<<" DELETE MENU "; 10
  • 11.
    gotoxy(8,10); cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~" <<"nntSearches & Deletes" <<"nntt1. By Code " <<"nntt2. By Name" <<"nnt3. Go to Administrator Menu." <<"nnt4. Exits the Program" <<"nnntt Your choice : "; cin>>ch; switch(ch) { case 1 : dc=1; del(); break; case 2 : dc=2; del(); break; case 3 : adm(); break; 11
  • 12.
    case 4 : exit(0); default : cout<<"nnnt Wrong choice entered !!!!! " ; } getch(); } } void edtmn() { int ch; while(1) { clrscr(); gotoxy(20,8); cout<<" EDIT MENU "; gotoxy(8,10); cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~" <<"nntSearches & Edits" <<"nntt1. By Code " 12
  • 13.
    <<"nntt2. By Name" <<"nnt3. Go to Administrator Menu." <<"nnt4. Exits the Program" <<"nnntt Your choice : "; cin>>ch; switch(ch) { case 1 : ec=1; edit(); break; case 2 : ec=2; edit(); break; case 3 : adm(); break; case 4 : exit(0); default : cout<<"nnnt Wrong choice entered !!!!! " ; } 13
  • 14.
    getch(); } } void dtin(int l) { l=l-1; clrscr(); c[l].cd=2010+csn; textcolor(MAGENTA); gotoxy(20,8); cprintf("INPUTS TRAVELLERS DETAILS "); textcolor(LIGHTBLUE); gotoxy(18,10); cprintf("Customer Code. "); cout<<c[l].cd; gotoxy(7,15); cout<<"Name : "; gets(c[l].nm); gotoxy(7,17); cout<<"From : "; gets(c[l].frm); gotoxy(7,19); cout<<"Destination : "; 14
  • 15.
    gets(c[l].to); gotoxy(7,21); cout<<"Address : "; gets(c[l].add); gotoxy(7,23); cout<<"Mode of Transport : "; gets(c[l].mod); gotoxy(7,25); cout<<"Phone No. : "; cin>>c[l].pn; gotoxy(7,27); cout<<"Mobile No. : "; cin>>c[l].mn; gotoxy(7,29); cout<<"No. of adults : "; cin>>c[l].na; gotoxy(7,31); cout<<"No. of children : "; cin>>c[l].nc; } void dtdis(int l) { clrscr(); 15
  • 16.
    textcolor(MAGENTA); gotoxy(20,8); cprintf("TRAVELLER'S DETAILS "); textcolor(LIGHTBLUE); gotoxy(18,10); cprintf("CustomerCode. "); cout<<c[l].cd; gotoxy(7,15); cout<<"Name : "; puts(c[l].nm); gotoxy(7,17); cout<<"From : "; puts(c[l].frm); gotoxy(7,19); cout<<"Destination : "; puts(c[l].to); gotoxy(7,21); cout<<"Address : "; puts(c[l].add); gotoxy(7,23); cout<<"Mode of Transport : "; puts(c[l].mod); gotoxy(7,25); 16
  • 17.
    cout<<"Phone No. :" <<c[l].pn; gotoxy(7,27); cout<<"Mobile No. :" <<c[l].mn; gotoxy(7,29); cout<<"No. of adults :" <<c[l].na; gotoxy(7,31); cout<<"No. of children :" <<c[l].nc; } void dslst() { clrscr(); int h=10; gotoxy(20,7); cout<<"TRAVELLER'S LIST" <<"nn Code" <<" Name" <<" Mode of Transport"; for(int i=0;i<csn;i++,h++,h++) { 17
  • 18.
    gotoxy(8,h); cout<<c[i].cd; gotoxy(20,h); puts(c[i].nm); gotoxy(35,h); puts(c[i].mod); } adm(); } void src() { int sc,flag=0; cout<<"nnttEnter the Code of the Traveller : "; cin>>sc; for(int i=0;i<csn;i++) { if(sc==c[i].cd) { flag=1; srr=i; ssr=1; dtdis(srr); } 18
  • 19.
    } if(flag==0) { cout<<"nntEntered code doesn't exist in the records !!!"; ssr=0; } getch(); } void srn() { char sn[25]; int x,flag=0,h=0; cout<<"nnntEnter the Name of the Traveller : "; gets(sn); for(int i=0;i<csn;i++) { x=strcmpi(c[i].nm,sn); h=1; // cout<<endl<<x<<endl; if(x==0) { flag=1; 19
  • 20.
    srr=i; ssr=1; dtdis(srr); } } if((flag==0&&x!=0)||h==0) { cout<<"nnntEntered Traveller doesn't exist in the records !!!"; ssr=0; } getch(); } void del() { clrscr(); if(dc==1); { src(); } if(dc==2); { 20
  • 21.
    srn(); } if(ssr==1) { for(int i=srr;i<csn;i++) { c[i].cd=c[i+1].cd; strcpy(c[i].nm,c[i+1].nm); strcpy(c[i].frm,c[i+1].frm); strcpy(c[i].to,c[i+1].to); strcpy(c[i].add,c[i+1].add); strcpy(c[i].mod,c[i+1].mod); c[i].pn=c[i+1].pn; c[i].mn=c[i+1].mn; c[i].na=c[i+1].na; c[i].nc=c[i+1].nc; } csn--; cout<<"nnt Entered traveller's details have been deleted sucessfully !!!"; } if(ssr==0) { cout<<"nnntEntered traveller's details not Deleted !!!"; 21
  • 22.
    } getch(); delmn(); } void edit() { int e; clrscr(); if(ec==1); { src(); } if(ec==2); { srn(); } if(ssr==1) { clrscr(); textcolor(MAGENTA); gotoxy(20,8); cprintf("EDITS TRAVELLERS DETAILS "); textcolor(LIGHTBLUE); 22
  • 23.
    gotoxy(18,10); cprintf("Customer Code. "); cout<<c[srr].cd; gotoxy(7,15); cout<<"Name : "; puts(c[srr].nm); e=getch(); if(e==8) { gotoxy(29,15); cout<<" "; gotoxy(29,15); gets(c[srr].nm); } gotoxy(7,17); cout<<"From : "; puts(c[srr].frm); e=getch(); if(e==8) { gotoxy(29,17); cout<<" "; gotoxy(29,17); 23
  • 24.
    gets(c[srr].frm); } gotoxy(7,19); cout<<"Destination : "; puts(c[srr].to); e=getch(); if(e==8) { gotoxy(29,19); cout<<" "; gotoxy(29,19); gets(c[srr].to); } gotoxy(7,21); cout<<"Address : "; puts(c[srr].add); e=getch(); if(e==8) { gotoxy(29,21); cout<<" "; gotoxy(29,21); gets(c[srr].add); 24
  • 25.
    } gotoxy(7,23); cout<<"Mode of Transport: "; puts(c[srr].mod); e=getch(); if(e==8) { gotoxy(29,23); cout<<" "; gotoxy(29,23); gets(c[srr].mod); } gotoxy(7,25); cout<<"Phone No. : "; cout<<c[srr].pn; e=getch(); if(e==8) { gotoxy(29,25); cout<<" "; gotoxy(29,25); cin>>c[srr].pn; } 25
  • 26.
    gotoxy(7,27); cout<<"Mobile No. : "; cout<<c[srr].mn; e=getch(); if(e==8) { gotoxy(29,27); cout<<" "; gotoxy(29,27); cin>>c[srr].mn; } gotoxy(7,29); cout<<"No. of adults : "; cout<<c[srr].na; e=getch(); if(e==8) { gotoxy(29,29); cout<<" "; gotoxy(29,29); cin>>c[srr].na; } gotoxy(7,31); 26
  • 27.
    cout<<"No. of children : "; cout<<c[srr].nc; e=getch(); if(e==8) { gotoxy(29,31); cout<<" "; gotoxy(29,31); cin>>c[srr].nc; } cout<<"nnt Entered traveller's details have been edited sucessfully !!!"; } if(ssr==0) { cout<<"nnntEntered traveller's details not Edited !!!"; } getch(); edtmn(); } void pswrd() { clrscr(); 27
  • 28.
    gd(); char pass[10],abs[10]="money"; char pp[3]={1,2,'0'}; int h,i,f,l; // gotoxy(5,5); textcolor(LIGHTRED); // cprintf("Enter the username : "); // gets(us); for(int s=1;s<=3;s++) { f=0; gotoxy(5,8); // textcolor(LIGHTBLUE); cprintf("Enter the Password : "); x: h=26; for(i=0;i>=0;i++,h++) { s: gotoxy(h,8); 28
  • 29.
    pass[i]=getch(); //b++; if(pass[i]==13) { break; } if(pass[i]==8) { h--; if(h<26) { goto x; } gotoxy(h,8); cout<<" "; i--; pass[i]=NULL; goto s; } cout<<"*"; } 29
  • 30.
    pass[i]=NULL; l=strlen(pass); cout<<"nn"; f=strcmp(pass,abs); if(f==0) { textcolor(LIGHTBLUE); cprintf("nnn Entered correct password !!!!!!!! n"); gotoxy(3,16); textcolor(YELLOW); cprintf("nProgram in process please wait....nnnn"); for(int j=0,k=0;j<50;k=k+2,j++) { gotoxy(5,20); textcolor(GREEN); cprintf(" Done "); cout<<k+2<<" % "; gotoxy(10+j,22); textcolor(MAGENTA); 30
  • 31.
    cprintf(pp); delay(200); } adm(); break; } else if(f!=0) { textcolor(CYAN); cprintf("nnn Wrong password entered !!!! Re-enter Password......"); //b++; for( i=0;i<l;i++,h--) { pass[i]=NULL; gotoxy(h-1,8); cout<<" "; } if(s==3) { gotoxy(2,18); textcolor(RED); cprintf("You have entered the password wrong 3 times.. "); 31
  • 32.
    gotoxy(2,20); cprintf("Now your program has been blocked !!!!"); } } } cout<<"nnnn"; getch(); } void wel() { clrscr(); textcolor(YELLOW); gotoxy(28,15); cprintf("WELCOME TO SPARKS TRAVELS "); gotoxy(40,35); textcolor(LIGHTBLUE); cprintf("Developed By - "); textcolor(BLUE+BLINK); cprintf("Parimal Chakole,DVS Srihari,Naina Ghate"); gd(); ext(); delay(1000); 32
  • 33.
    chkmn(); } void gd() { //textbackground(WHITE); textcolor(RED); for(int i=1;i<80;i++) //outer hori. { gotoxy(i,1); cprintf("*"); gotoxy(i,50); cprintf("*"); } textcolor(GREEN+BLINK); for(i=3;i<78;i++) // inner hori. { gotoxy(i,2); cprintf("."); gotoxy(i,48); cprintf("."); } textcolor(RED); 33
  • 34.
    for(int j=1;j<50;j++) // outer vert. { gotoxy(1,j); cprintf("*"); gotoxy(80,j); cprintf("*"); } textcolor(GREEN+BLINK); for(j=2;j<48;j++) // inner vert. { gotoxy(3,j); cprintf("."); gotoxy(78,j); cprintf("."); } gotoxy(5,5); } void bdr() { textcolor(GREEN+BLINK); for(int i=1;i<80;i++) //outer hori. { gotoxy(i,1); 34
  • 35.
    cprintf("@"); gotoxy(i,50); cprintf("@"); } textcolor(RED); for(i=3;i<78;i++) // inner hori. { gotoxy(i,2); cprintf("."); gotoxy(i,48); cprintf("."); } textcolor(GREEN+BLINK); for(int j=1;j<50;j++) // outer vert. { gotoxy(1,j); cprintf("@"); gotoxy(80,j); cprintf("@"); } textcolor(RED); for(j=2;j<48;j++) // inner vert. 35
  • 36.
    { gotoxy(3,j); cprintf("."); gotoxy(78,j); cprintf("."); } gotoxy(5,5); } void crux() { // clrscr(); textcolor(RED+BLUE); cprintf(" $$$$ $$$$ $ $ $ $"); cout<<endl; cprintf(" $ $ $ $ $ $ $ "); cout<<endl; cprintf(" $ $$$$ $ $ $$ "); cout<<endl; cprintf(" $ $ $$ $ $ $ $ "); cout<<endl; cprintf(" $$$$ $ $ $$$ $ $"); cout<<"nnnn"; cprintf(" $$$$$$$ $$$$ $$$ $ $ $$$$$ $ $$$$"); cout<<endl; cprintf(" $ $ $$ $$ $$ $ $$ "); cout<<endl; cprintf(" $ $$$$ $$$$$ $ $ $$$ $ $$$ "); cout<<endl; cprintf(" $ $ $$ $ $ $ $ $ $ $$"); cout<<endl; cprintf(" $ $ $ $ $ $ $$$$$ $$$$$ $$$$ "); 36
  • 37.
    } void sparks() { // clrscr(); textcolor(RED+BLUE); gotoxy(1,7); cprintf(" $$$$ $$$$ $$$ $$$$ $ $ $$$$ "); cout<<endl; cprintf(" $$ $ $ $ $ $ $ $ $ $$ "); cout<<endl; cprintf(" $$$ $$$$ $$$$$ $$$$ $$$ $$$ ");cout<<endl; cprintf(" $$ $ $ $ $ $$ $ $ $$ "); cout<<endl; cprintf(" $$$$ $ $ $ $ $ $ $ $$$$ "); cout<<"nnnn"; cprintf(" $$$$$$$ $$$$ $$$ $ $ $$$$$ $ $$$$"); cout<<endl; cprintf(" $ $ $$ $$ $$ $ $$ "); cout<<endl; cprintf(" $ $$$$ $$$$$ $ $ $$$ $ $$$ "); cout<<endl; cprintf(" $ $ $$ $ $ $ $ $ $ $$"); cout<<endl; cprintf(" $ $ $ $ $ $ $$$$$ $$$$$ $$$$ "); } void ext() { int k; gotoxy(5,43); 37
  • 38.
    cout<<"Press ESC toExit the Program "; k=getch(); if(k==27) { gotoxy(20,45); cout<<"Terminating Program.........."; delay(1000); exit(0); } } void date() { cout<<"Enter the year : "; cin>>dt.y; while(dt.y<=999||dt.y>1) { cout<<"Invalid year re-enter : "; cin>>dt.y; } dt.lp=leap(dt.y); cout<<"Enter t "; 38
  • 39.
    cin>>dt.m; while(dt.m<1||dt.m>12) { cout<<"Invalid year re-enter : "; cin>>dt.m; } cout<<"Enter the date : "; cin>>dt.d; while(dt.d>md[dt.m-1]||dt.d<1) { cout<<"Invalid date re-enter : "; cin>>dt.d; } } int leap(int x) { int lp=0; if((x%4==0)||((x%400==0)&&(x%100==0))) { lp=1; md[2]=28; 39
  • 40.
    } return lp; } void time() { cout<<"Enter hours : "; cin>>tm.h; while(tm.h>12) { cout<<"Invalid hours re-enter : "; cin>>tm.h; } cout<<"Enter minutes : "; cin>>tm.m; while(tm.m>60) { cout<<"Invalid minutes re-enter : "; cin>>tm.m; } cout<<"Enter seconds : "; cin>>tm.s; 40
  • 41.
    while(tm.s>60) { cout<<"Invalid seconds re-enter : "; cin>>tm.s; } cout<<"nIs it A.M. or P.M. ??" <<"nEnter 1. A.M." <<"nEnter 2. P.M." <<"nnYour choice : "; cin>>tm.t; while(tm.t!=1&&tm.t!=2) { cout<<"Invalid time re-enter : "; cin>>tm.t; } if(tm.t==1) { strcpy(tm.tt,ta); // puts(tb); strcpy(tm.x,tb); } if(tm.t==2) { 41
  • 42.
    strcpy(tm.tt,tb); // puts(ta); strcpy(tm.x,ta); } tm.tt[4]='0'; tm.x[4]='0'; distm(); tmchg(); } void distm() { gotoxy(15,15); cprintf(" "); cout<<tm.h<<":" <<tm.m<<":" <<tm.s<<" " <<tm.tt; } void tmchg() { for(int a=tm.h;a<=12;a++) { 42
  • 43.
    for(int b=tm.m;b<60;b++) { for(int c=tm.s;c<=60;c++) { delay(1003); // gotoxy(15,15); distm(); tm.s++; if(kbhit()) { delay(500); gotoxy(7,25); cout<<"Time Stopped !!!!"; delay(1000); cout<<"Terminating......."; delay(2000); } if(tm.h==12&&tm.m==59&&tm.s==60) { tm.h=1; a=1; tm.m=0; b=0; 43
  • 44.
    tm.s=0; c=0; swap(tm.tt,tm.x); } } tm.m++; tm.s=00; } tm.h++; tm.m=00; } } void swap(char a[5], char b[5]) { char c[5]; strcpy(c,a); strcpy(a,b); strcpy(b,c); } 44
  • 45.
  • 46.
  • 47.
  • 48.