From dec7c1c9920daf980bee469c0e5d8b8e4c0612e0 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 19 Feb 2019 19:47:06 -0600 Subject: ? --- ee1301/wk2/hw2_directory/strap012_2B.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ee1301/wk2/hw2_directory/strap012_2B.cpp') 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') { -- cgit v1.2.3