1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
#include "d.h"
#include<conio.h>
#include<fstream>
#include<string.h>
#include<ctime>
#include<sstream>
using namespace std;
void gotoxy( int column, int line )
{
COORD coord;
coord.X = column;
coord.Y = line;
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ),coord);
}
void clear(int x,int y)
{
int bac;
gotoxy(x,y);
for(bac=1;bac<50;bac++)
cout<<" ";
gotoxy(x,y);
}
void loadingscreen()
{
int i,j,k;
cout<<"\n\n\n\n\n\t\t\t\t LOADING\n\n\t\t\t\t";
for(i=0;i<=2;i++)
{
for(j=1;j<=10;j++)
{
cout<<".";
for(k=0;k<=500;k++)
{
cout<<" "<<"\b\b";
}}
cout<<"\b\b\b\b\b\b\b\b\b\b";
}
}
long generatenumber()
{
int i;
srand((unsigned)time(0));
long ticket=rand()%10;
for(i=1;i<=10;i++)
{
ticket*=10;
ticket+=rand()%10;
}
if(ticket<0)
ticket*=-1;
return ticket;
}
int main()
{
int count,date,month,year,j,i,pdate=0;
long PNR;
string name,boardingstn,destinationstn;
loadingscreen();
clear(0,5);
clear(0,7);
gotoxy(0,0);
cout<<"(1) Make a New Reservation\n(2) View Train Availability\n(3) Check your Ticket status\n(4) View Seat availability\n(5)Cancel Reservation";
cout<<"\nENTER YOUR OPTION :";
cin>>count;
cin.get();
switch(count)
{
case 1:
system("CLS");
cout<<"\t\t\tNEW RESERVATION FORM";
PNR=generatenumber();
cout<<"\n\n\nPNR NUMBER :"<<PNR<<endl<<endl;
loopdate:
cout<<"Enter date of travel :";
cin>>date;
cin.get();
if(date<1 || date>31)
{
gotoxy(0,5);
clear(0,5);
gotoxy(0,5);
goto loopdate;
}
loopmonth:
cout<<"Enter month of travel :";
cin>>month;
cin.get();
if(month<1 || month>12)
{
gotoxy(0,6);
clear(0,6);
gotoxy(0,6);
goto loopmonth;;
}
loopyear:
cout<<"Enter year of travel :";
cin>>year;
cin.get();
if(year<2011)
{
gotoxy(0,7);
clear(0,7);
gotoxy(0,7);
goto loopyear;
}
pdate=processdate(date,month,year);
clear(0,5);
clear(0,6);
clear(0,7);
if(pdate==1)
{ gotoxy(0,5);
goto loopdate;}
gotoxy(40,3);
cout<<"Date of Travel :"<<date<<"/"<<month<<"/"<<year;
cout<<"\n\n\nEnter your full name :";
getline(cin,name);
cout<<"Enter the Boarding station code";
getline(cin,boardingstn);
cout<<"Enter the Destination station code";
getline(cin,destinationstn);
ofstream fout;
stringstream buffer;
buffer<<PNR<<".txt";
fout.open(buffer.str().c_str(),ios::out);
fout<<buffer<<endl<<date<<"/"<<month<<"/"<<year<<endl<<name<<endl<<boardingstn<<endl<<destinationstn<<endl;
fout.close();
break;
default:
cout<<"Plz enter a correct option";
}
getch();
}
|