aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk2
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-02-19 19:47:06 -0600
committerRossTheRoss <msattr@gmail.com>2019-02-19 19:47:06 -0600
commitdec7c1c9920daf980bee469c0e5d8b8e4c0612e0 (patch)
treeef57bd736b087a8819d8957ebf6051576d6be225 /ee1301/wk2
parentI am dumb (diff)
downloadhomework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar.gz
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar.bz2
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar.lz
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar.xz
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.tar.zst
homework-dec7c1c9920daf980bee469c0e5d8b8e4c0612e0.zip
?
Diffstat (limited to 'ee1301/wk2')
-rw-r--r--ee1301/wk2/hw2_directory/strap012_2B.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp
index 4675b35..ff060a8 100644
--- a/ee1301/wk2/hw2_directory/strap012_2B.cpp
+++ b/ee1301/wk2/hw2_directory/strap012_2B.cpp
@@ -14,7 +14,7 @@ using namespace std;
int main()
{
- bool change12=0, foo=0, bar=true; //Workaround to prevent unneeded if statements
+ bool change12=0, foo=0, bar=false; //Workaround to prevent unneeded if statements
char Time, travel; //"time" is reserved by C++, "Time" is not
int hourOG, hourChange, hourNew, intervalChange = 0, timeChange = 1;
cout << "Enter current time (A for AM, P for PM): ";
@@ -27,13 +27,14 @@ int main()
intervalChange++;
}
if (travel=='F') {
- if (hourOG+hourChange>=12 && bar) {
+ if (hourOG+hourChange>=12) {
if (hourOG+hourChange==12) {
timeChange++;
} else {
hourNew=(hourOG+hourChange)-12;
- bar=false;
+ bar=true;
}
+ timeChange++;
}
}
if (travel=='B') {
@@ -58,9 +59,9 @@ int main()
//foo = false;
}
}
- if (travel == 'F')
+ if (travel == 'F' && !bar)
{
- //hourNew = hourOG + intervalChange;
+ hourNew = hourOG + intervalChange;
}
if (travel == 'B')
{