Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions station_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string.h>
#include <cstring>
#include <iomanip>
#include <ctime.h> // to get system local date and time

using namespace std;

Expand Down Expand Up @@ -151,6 +152,7 @@ class metroline
cout<<ending;
cout<<"\n\nPlease board the train moving towards Rithala from platform number 1"<<endl;
cout<<"\nYour total fare will be Rs. "<<(((no_of_stations)*15)>50) ? (50) : (no_of_stations*15);
cout<<"\n Booking Date and Time : "<< dt << endl; // booking date and time printing
}
else
{
Expand All @@ -159,14 +161,18 @@ class metroline
cout<<"\n\nEnding Station: ";
cout<<ending;
cout<<"\n\nPlease board the train moving towards Dilshad Garden from platform number 2"<<endl;
cout<<"\nYour total fare will be Rs. "<<(((-no_of_stations)*15)>50) ? (50) : (-no_of_stations*15);;
cout<<"\nYour total fare will be Rs. "<<(((-no_of_stations)*15)>50) ? (50) : (-no_of_stations*15);
cout<<"\n Booking Date and Time : "<< dt << endl; // booking date and time printing
}
}
};

int main()
{
clrscr();
time_t now = time(0); // for date and time
char* dt = ctime(&now);

metroline red("red"),yellow("yellow");
int choice,ch;
char char_choice;
Expand Down Expand Up @@ -256,4 +262,4 @@ int main()

} while(char_choice == 'y' || char_choice == 'Y');
return 0;
}
}