diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-19 19:18:35 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-19 19:18:35 -0600 |
commit | 5d832905197f850c64a4a659c4cdf7671880ba1c (patch) | |
tree | ce2401ec1197be93b605ef4bf2189e9f5df30bf6 /ee1301/wk2/hw2_directory | |
parent | AHHHHHH (diff) | |
download | homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar.gz homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar.bz2 homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar.lz homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar.xz homework-5d832905197f850c64a4a659c4cdf7671880ba1c.tar.zst homework-5d832905197f850c64a4a659c4cdf7671880ba1c.zip |
E
Diffstat (limited to '')
-rw-r--r-- | ee1301/wk2/hw2_directory/strap012_2B.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp index b5317bb..862a0de 100644 --- a/ee1301/wk2/hw2_directory/strap012_2B.cpp +++ b/ee1301/wk2/hw2_directory/strap012_2B.cpp @@ -21,28 +21,25 @@ int main() cin >> hourOG >> Time; cout << "How many hours forward or backward do you want to move the clock (F for forwards, B for backward): "; cin >> hourChange >> travel; + if (hourOG+hourChange>12) { + + } + for (int i = hourChange; i >= 0; i--) { - if (i != 0) - { + if (i != 0) { intervalChange++; } - do - { - if (travel == 'B' && hourOG - intervalChange < 0) - { - if (hourChange < 12) - { + do { + if (travel == 'B' && hourOG - intervalChange < 0){ + if (hourChange < 12){ intervalChange -= 12; - } - else - { - intervalChange = 12 - intervalChange; - if (intervalChange >= 13) - { - intervalChange -= 12; + } else { + intervalChange = 12 - intervalChange; + if (intervalChange >= 13){ + intervalChange -= 12; + } } - } timeChange++; } } while (intervalChange > 12); |