-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountdown Clock.cpp
More file actions
48 lines (40 loc) · 1.08 KB
/
Countdown Clock.cpp
File metadata and controls
48 lines (40 loc) · 1.08 KB
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
/*
Randall Hall
C++ Program to countdown from a entered hour and minute
*/
#include <iostream>
using namespace std;
int main ()
{
int hour, minute;
do {
cout << "Please enter a hour from 0 to 5: ";
cin >> hour;
if (hour < 0 || hour > 5)
cout << "Please re-read the directions" << endl;
} while (hour < 0 || hour > 5);
do {
cout << "Please enter a minute from 0 to 59: ";
cin >> minute;
if (minute < 0 || minute > 59)
cout << "Please re-read the directions" << endl;
} while (minute < 0 || minute > 59);
cout << "\n";
cout << "Countdown Begins." << endl;
if (hour < 10 || minute < 10);
cout << "You have 0" << hour << ":0" << minute << " to get out of here!\n" ;
cout << "\n";
for (hour = hour; hour >= 0; hour--)
{
for (minute = minute; minute >= 0; minute--)
{
if (hour < 10) cout << "0";
cout << hour << ":";
if (minute < 10) cout << "0";
cout << minute << endl;
}
minute = 59;
}
cout << "KABLOOM!" << endl;
return 0;
}