Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  s.cpp
Language: C/C++
Code:
#include<iostream.h>
#include<conio.h>
//#include<stdlib.h>
#include<time.h>

void bookticket();
void main()
{
clrscr();
int x,bdate,month,year,train_type,tickets,sum;
char name[10],bplace[10],choice;
cout<<" :-----------------------------------------------------------------------------:"<<"\n";
cout<<" :--------------------WELCOME TO THE RAILWAY BOOKING CENTER--------------------:"<<"\n";
cout<<" :-----------------------------------------------------------------------------:"<<"\n";
cout<<"\t\t $$ WE WISH YOU A GREAT AND ENJOYABLE JOURNEY $$"<<"\n\n";
//current date/time based on current system
time_t now= time(0);
//convert now to string form
char* dt= ctime(&now);
cout<<"\t\t\t    "<<dt;
cout<<"\nEnter name of the traveller : ";
cin>>name;
cout<<"Your Boarding Place is : Jalandhar ";
cout<<" "<<"\n";
cout<<"\t\t\t------ Destination Places ------\n";
cout<<"\t\t\t        :--------------:"<<"\n";
cout<<"\t\t\t        :   1.Mumbai   :"<<"\n";
cout<<"\t\t\t        :   2.Delhi    :"<<"\n";
cout<<"\t\t\t        :   3.Amritsar :"<<"\n";
cout<<"\t\t\t        :   4.haryana  :"<<"\n";
cout<<"\t\t\t        :   5.kerela   :"<<"\n";
cout<<"\t\t\t        :   6.J/K      :"<<"\n";
cout<<"\t\t\t        :--------------:"<<"\n";
cout<<"\t\t\t                        "<<"\n";
cout<<"\t              Please select your Destination Place : ";
cin>>x;
cout<<"\n";

switch(x)
{
case 1: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to Mumbai \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Paschim Express \n\n";
     cout<<" \t\t2.Asr Ltt Express \n\n";
     cout<<" \t\t3.Swaraj Express  \n\n";
     cout<<" \t\t\t\t\n          Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t:--------------------------:\n";
               cout<<"\t\t\t:--- welcome to booking ---:\n";
               cout<<"\t\t\t:--------------------------:\n";

               bookticket();
               break;

           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
           break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          cin>>tickets;

          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 3: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          cin>>tickets;

          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
          default: cout<<"incorrect option";
          break;
           }
          break;
case 2: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to Delhi \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Sarvodaya Express \n\n";
     cout<<" \t\t2.Swaraj Express \n\n";
     cout<<" \t\t3.Paschim Express \n\n";
     cout<<" Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 3: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;

          default: cout<<"incorrect option";
          break;
                       }
            break;
case 3: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to Amritsar \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Amritsar Express \n\n";
     cout<<" \t\t2.Jalianwalab Express \n\n";
     cout<<" \t\t3.Chattisgarh Express \n\n";
     cout<<" Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 3: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";
               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;

          default: cout<<"incorrect option";
          break;
                       }
            break;
case 4: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to haryana \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Amarnath Express\n\n";
     cout<<" \t\t2.Lohit Express\n\n";
     cout<<" \t\t3.Hemkunt Express\n\n";
            cout<<" Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;


          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 3: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;


          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;

          default: cout<<"incorrect option";
          break;
                       }
     break;
case 5: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to kerela \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Asr Kcvl Expres \n\n";
     cout<<" \t\t2.Jammu Tawi Himsagar Express \n\n";
     cout<<" Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;



          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;


          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;                  }
     break;
case 6: clrscr();
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<"\t\t\tList of trains available from Jalandhar to J/K \n";
     cout<<"--------------------------------------------------------------------------------\n";
     cout<<" \t\t1.Swaraj Express (PT) \n\n";
     cout<<" \t\t2.Sarvodaya Express\n\n";
     cout<<" \t\t3.Mour Dhwaj Express \n\n";
     cout<<"Choose train of your choice : ";
     cin>>train_type;
     switch(train_type)
     {
     case 1: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;
          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";

               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 2: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;
     case 3: clrscr();
          cout<<"\t""\t""\t"" ---Welcome to Reservation Portal--- ""\n\n";
          cout<<"\t\t\nEnter boarding date (IN DIGITS ) :-- \n";
          cout<<"\t\t\nDate Of Departure (DD):";
          cin>>bdate;
          cout<<"\t\t\nMonth Of Departure (MM):";
          cin>>month;
          cout<<"\t\t\nYear Of Departure (YYYY):";
          cin>>year;
          cout<<" \t\t\t\t\t\n\nTypes of Tickets Available \n\n";
          cout<<" \t1. Sleeper class \n\n";
          cout<<" \t2. AC 1-tier \n\n";
          cout<<" \t3. Ac 2-tier \n\n";
          cout<<" \t\t\nChoose the type of ticket :";
          cin>>tickets;
          //float num=rand()%10+1;
          //cout<<"number of seats avalable : "<<num;

          switch(tickets)
          {
           case 1:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 2:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           case 3:clrscr();
               cout<<"\t\t\t**************************** \n";
               cout<<"\t\t\t**** welcome to booking **** \n";
               cout<<"\t\t\t**************************** \n";


               bookticket();
               break;
           default:cout<<"PLEASE CHOOSE A CORRECT \n ";
               break;
           }
          break;

          default: cout<<"incorrect option";
          break;
          }
default: cout<<"incorrect option please click a valid option";
          break;
}


getch();
}

void bookticket()
{
int number;
char choice;
cout<<"                                                          :-------------------:\n";
cout<<"              There are 10 tickets available              : 1 TICKET = Rs 250 :\n";
cout<<"              ------------------------------              :-------------------:\n";
cout<<"        enter the number of tickets you want to book : ";
cin>>number;
cout<<"                                                                               \n";
cout<<"                                                                               \n";
cout<<"        Total cost of your booking is : "<<number*250<< "";
cout<<"                                                                               \n";
cout<<"                                                                               \n";
cout<<"        Remaining tickets available for booking now are : "<<10-number<<"" ;
cout<<"                                                                               \n";
cout<<"                                                                               \n";
cout<<"        Press Y to confirm the booking and N to cancel the booking : ";
cin>>choice;
switch(choice)
{
 case 'y' : cout<<"                                        \n ";
         cout<<"                                        \n ";
         cout<<"\t\t  $$ THANK YOU BOOKING PLEASE VISIT AGAIN $$  ";
         cout<<"                                   \n ";
         cout<<"                                   \n ";
         cout<<"\t\t  $$ click on any key to close the program $$  \n ";
         break;
 case 'n' : cout<<"                                                      \n ";
         cout<<"                                                      \n ";
         cout<<"\t\t         $$ SUCCESSFULLY CANCELED $$              \n ";
         cout<<"                                                      \n ";
         cout<<"                                                      \n ";
         cout<<"\t\t  $$ click on any key to close the program $$     \n ";
         break;
 default :  cout<<"                                                \n ";
         cout<<"            INCORRECT VALUE PLEASE CHOICE FROM GIVEN OPTION \n ";
         cout<<"            ----------------------------------------------- \n";
         cout<<"              $$ click on any key to close the program $$     \n ";
         cout<<"              -------------------------------------------     \n ";
         break;
}

}



Comments: