aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk2/hw2_directory
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-02-19 21:29:59 +0000
committerRossTheRoss <msattr@gmail.com>2019-02-19 21:29:59 +0000
commit41228b1eee2261ff481f20baffc6d5898631fd5f (patch)
treed44816c56ff057e6a548e11e1ec5e384a86c0643 /ee1301/wk2/hw2_directory
parent(Screams internally) (diff)
downloadhomework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar.gz
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar.bz2
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar.lz
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar.xz
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.tar.zst
homework-41228b1eee2261ff481f20baffc6d5898631fd5f.zip
(More screaming)
Diffstat (limited to 'ee1301/wk2/hw2_directory')
-rw-r--r--ee1301/wk2/hw2_directory/strap012_2B.cpp13
1 files changed, 9 insertions, 4 deletions
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) {