From 654f7221575d24048c397d9b8b9e7b45705e7075 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 19 Feb 2019 21:31:07 +0000 Subject: Recursion is bad --- ee1301/wk2/hw2_directory/strap012_2B.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ee1301') diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp index 2a600b4..3ed926c 100644 --- a/ee1301/wk2/hw2_directory/strap012_2B.cpp +++ b/ee1301/wk2/hw2_directory/strap012_2B.cpp @@ -24,17 +24,19 @@ int main () { if (i!=0){ intervalChange++; } do { + // STILL BROKEN if (travel=='B' && hourOG-intervalChange<0){ if (hourChange<12) { - intervalChange-=12; + intervalChange=12-hourChange; } else { - intervalChange=12-intervalChange; + intervalChange=hourChange-12; if (intervalChange>=13) { intervalChange-=12; } } timeChange++; } + // STILL BROKEN } while (intervalChange>12); if (intervalChange>=12) { //if (intervalChange !=12) {i -- cgit v1.2.3