From 9567a200c8139f40a5fea6fd5bd46bca44cf59df Mon Sep 17 00:00:00 2001 From: B-Anupam <71441129+B-Anupam@users.noreply.github.com> Date: Thu, 1 Oct 2020 15:13:25 +0530 Subject: [PATCH] Update station_finder.cpp Updated with date and time in the boarding pass. --- station_finder.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/station_finder.cpp b/station_finder.cpp index 3fde8fe..dedad49 100644 --- a/station_finder.cpp +++ b/station_finder.cpp @@ -3,6 +3,7 @@ #include #include #include +#include // to get system local date and time using namespace std; @@ -151,6 +152,7 @@ class metroline cout<50) ? (50) : (no_of_stations*15); + cout<<"\n Booking Date and Time : "<< dt << endl; // booking date and time printing } else { @@ -159,7 +161,8 @@ class metroline cout<<"\n\nEnding Station: "; cout<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 } } }; @@ -167,6 +170,9 @@ class metroline 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; @@ -256,4 +262,4 @@ int main() } while(char_choice == 'y' || char_choice == 'Y'); return 0; -} \ No newline at end of file +}