diff options
Diffstat (limited to 'CST116F2021-Lab4/CST116F2021-Lab4.cpp')
| -rw-r--r-- | CST116F2021-Lab4/CST116F2021-Lab4.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CST116F2021-Lab4/CST116F2021-Lab4.cpp b/CST116F2021-Lab4/CST116F2021-Lab4.cpp index 2859c0d..1006a43 100644 --- a/CST116F2021-Lab4/CST116F2021-Lab4.cpp +++ b/CST116F2021-Lab4/CST116F2021-Lab4.cpp @@ -16,9 +16,23 @@ int main() void GetInput(int hours_input, int minutes_input, int seconds_input) { - cout << "Please enter the current hour of day: "; - cin >> hours_input; + do + { + cout << "Please enter the current hour out of 24 per day: "; + cin >> hours_input; + } while (hours_input <= 0 || hours_input > 24); + do + { + cout << "Please enter the current minutes out of 60 per hour: "; + cin >> minutes_input; + } while (minutes_input <= 0 || minutes_input > 60); + + do + { + cout << "Please enter the current seconds out of 60 per minute: "; + cin >> seconds_input; + } while (seconds_input <= 0 || seconds_input > 60); } void DisplayTime(float standard_display, float military_display, float hours_display) |