aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk2
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2019-02-19 19:36:23 -0600
committerGitHub <noreply@github.com>2019-02-19 19:36:23 -0600
commit935c88a62a5b303085e2d314a03ea64087c38e2a (patch)
tree104ebfbcf993fff57b51680b9c5526e6c7c90e2b /ee1301/wk2
parentAHHHHHH (diff)
parentF (diff)
downloadhomework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar.gz
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar.bz2
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar.lz
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar.xz
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.tar.zst
homework-935c88a62a5b303085e2d314a03ea64087c38e2a.zip
Merge pull request #1 from RosstheRoss/Backup
Backup
Diffstat (limited to 'ee1301/wk2')
-rw-r--r--ee1301/wk2/hw2_directory/strap012_2B.cpp70
1 files changed, 20 insertions, 50 deletions
diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp
index b5317bb..be727a3 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; //Workaround to prevent unneeded if statements
+ bool change12=0, foo=0, bar=true; //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): ";
@@ -23,71 +23,41 @@ int main()
cin >> hourChange >> travel;
for (int i = hourChange; i >= 0; i--)
{
- if (i != 0)
- {
- intervalChange++;
- }
- do
- {
- if (travel == 'B' && hourOG - intervalChange < 0)
- {
- if (hourChange < 12)
- {
- intervalChange -= 12;
+ if (travel=='F') {
+ if (hourOG+hourChange>=12 && bar) {
+ if (hourOG+hourChange==12) {
+ timeChange++;
+ } else {
+ hourNew=(hourOG+hourChange)-12;
+ bar=false;
}
- else
- {
- intervalChange = 12 - intervalChange;
- if (intervalChange >= 13)
- {
- intervalChange -= 12;
- }
- }
- timeChange++;
}
- } while (intervalChange > 12);
- if (intervalChange >= 12)
- {
- //if (intervalChange !=12) {i
- intervalChange = 0;
- timeChange++;
- //change12=1;
}
- }
+ if (travel=='B') {
- /* if (hourOG+hourChange>=12 || hourOG-hourChange<=0) {
- if (hourOG!=0 ^ hourOG!=12) {
- hourOG-=12;
}
- if (hourChange>12) {
- do {
- hourChange-=12;
- timeChange+=1;
- } while (hourChange >=11);
- }
- change12=1;
+ if (intervalChange >= 12) {
+ intervalChange = 0;
+ timeChange++;
+ }
}
-*/
- for (timeChange; timeChange > 1; timeChange--)
- {
+ for (timeChange; timeChange > 1; timeChange--) {
//if (change12) {
if (Time == 'A')
{
Time += 15;
- foo = true;
- }
- if (Time == 'P' && !foo)
- {
+ //foo = true;
+ } else {
+ if (Time == 'P') { //&& !foo) {
Time -= 15;
}
- foo = 0;
- //}
+ //foo = false;
+ }
}
-
if (travel == 'F')
{
- hourNew = hourOG + intervalChange;
+ //hourNew = hourOG + intervalChange;
}
if (travel == 'B')
{