From 41228b1eee2261ff481f20baffc6d5898631fd5f Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 19 Feb 2019 21:29:59 +0000 Subject: (More screaming) --- ee1301/wk2/hw2_directory/strap012_2B.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'ee1301/wk2/hw2_directory') diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp index b07028a..2a600b4 100644 --- a/ee1301/wk2/hw2_directory/strap012_2B.cpp +++ b/ee1301/wk2/hw2_directory/strap012_2B.cpp @@ -25,10 +25,15 @@ int main () { intervalChange++; } do { if (travel=='B' && hourOG-intervalChange<0){ - if (hourChange<12) - intervalChange=12-hourChange; - else - intervalChange=hourChange-12; + if (hourChange<12) { + intervalChange-=12; + } else { + intervalChange=12-intervalChange; + if (intervalChange>=13) { + intervalChange-=12; + } + } + timeChange++; } } while (intervalChange>12); if (intervalChange>=12) { -- cgit v1.2.3