From d8d0c36dfa1530ce8efcba24d796dfcea32a81fb Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 19 Feb 2019 21:44:42 -0600 Subject: AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH --- ee1301/wk2/hw2_directory/strap012_2A.cpp | 51 ------------------ ee1301/wk2/hw2_directory/strap012_2B.cpp | 83 ---------------------------- ee1301/wk2/hw2_directory/strap012_2C.cpp | 15 ------ ee1301/wk2/hw2_directory/strap012_HW2A.cpp | 51 ++++++++++++++++++ ee1301/wk2/hw2_directory/strap012_HW2B.cpp | 86 ++++++++++++++++++++++++++++++ ee1301/wk2/hw2_directory/strap012_HW2C.cpp | 15 ++++++ 6 files changed, 152 insertions(+), 149 deletions(-) delete mode 100644 ee1301/wk2/hw2_directory/strap012_2A.cpp delete mode 100644 ee1301/wk2/hw2_directory/strap012_2B.cpp delete mode 100644 ee1301/wk2/hw2_directory/strap012_2C.cpp create mode 100644 ee1301/wk2/hw2_directory/strap012_HW2A.cpp create mode 100644 ee1301/wk2/hw2_directory/strap012_HW2B.cpp create mode 100644 ee1301/wk2/hw2_directory/strap012_HW2C.cpp (limited to 'ee1301/wk2') diff --git a/ee1301/wk2/hw2_directory/strap012_2A.cpp b/ee1301/wk2/hw2_directory/strap012_2A.cpp deleted file mode 100644 index 3129241..0000000 --- a/ee1301/wk2/hw2_directory/strap012_2A.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -Date: 20 Feb 2019 -Name: Matthew Strapp -Student ID number: 5449340 -Course number: EE1301 -Term: Spring 2019 -Lab/assignment number: Homework 2A -Short Program Description: Useless Counter -*/ - -#include -using namespace std; -int main () { - int countOG, i, j; - -do { - - do { - cout << "Enter an integer from -50 to 50: "; - cin >> countOG; - } while (countOG > 50 || countOG < -50); - - int count=countOG; //Store original integer for comparison to break loop - - if (countOG < 0){ - count*=-1; - for (i=count; i>0; i--) { - for (j=count; j>0; j--) { - cout << count; - } - count--; - cout << endl; - } - } - - if (countOG > 0) { - count=1; //Sets initial printing of countOG to 1 - for (i=1; i<=countOG; i++) { - for (j=0; j -using namespace std; -int main() -{ - - 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): "; - cin >> hourOG >> Time; - cout << "How many hours forward or backward do you want to move the clock (F for forwards, B for backward): "; - cin >> travel >> hourChange; - for (int i = hourChange; i >= 0; i--) - { - if (i != 0) - { - intervalChange++; - } - - if (travel == 'F') - { - if (hourOG + hourChange >= 12 && bar) - { - if (hourOG + hourChange == 12) - { - timeChange++; - } - else - { - hourNew = (hourOG + hourChange) - 12; - bar = false; - } - } - } - - if (travel == 'B') - { - } - if (intervalChange >= 12) - { - intervalChange = 0; - timeChange++; - } - } - - for (timeChange; timeChange > 1; timeChange--) - { - if (Time == 'A') - { - Time += 15; - } - else - { - if (Time == 'P') - { - Time -= 15; - } - } - } - if (travel == 'F') - { - hourNew = hourOG + intervalChange; - } - if (travel == 'B') - { - hourNew = hourOG + intervalChange; - } - - cout << "The new time is: " << hourNew << " " << Time << "M" << endl; - return 0; -} \ No newline at end of file diff --git a/ee1301/wk2/hw2_directory/strap012_2C.cpp b/ee1301/wk2/hw2_directory/strap012_2C.cpp deleted file mode 100644 index f300a04..0000000 --- a/ee1301/wk2/hw2_directory/strap012_2C.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* -Date: 20 Feb 2019 -Name: Matthew Strapp -Student ID number: 5449340 -Course number: EE1301 -Term: Spring 2019 -Lab/assignment number: Homework 2B -Short Program Description: Time Calculator -*/ - -#include -using namespace std; -int main () { - -} \ No newline at end of file diff --git a/ee1301/wk2/hw2_directory/strap012_HW2A.cpp b/ee1301/wk2/hw2_directory/strap012_HW2A.cpp new file mode 100644 index 0000000..3129241 --- /dev/null +++ b/ee1301/wk2/hw2_directory/strap012_HW2A.cpp @@ -0,0 +1,51 @@ +/* +Date: 20 Feb 2019 +Name: Matthew Strapp +Student ID number: 5449340 +Course number: EE1301 +Term: Spring 2019 +Lab/assignment number: Homework 2A +Short Program Description: Useless Counter +*/ + +#include +using namespace std; +int main () { + int countOG, i, j; + +do { + + do { + cout << "Enter an integer from -50 to 50: "; + cin >> countOG; + } while (countOG > 50 || countOG < -50); + + int count=countOG; //Store original integer for comparison to break loop + + if (countOG < 0){ + count*=-1; + for (i=count; i>0; i--) { + for (j=count; j>0; j--) { + cout << count; + } + count--; + cout << endl; + } + } + + if (countOG > 0) { + count=1; //Sets initial printing of countOG to 1 + for (i=1; i<=countOG; i++) { + for (j=0; j +using namespace std; +int main() +{ + + bool change12 = 0, foo = 0; //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): "; + 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; + for (int i = hourChange; i >= 0; i--) + { + if (i != 0) + { + intervalChange++; + } + /* do + { + STILL BROKEN + if (travel == 'B' && hourOG - intervalChange < 0) + { + if (hourChange < 12) + { + intervalChange = 12 - hourChange; + } + else + { + intervalChange = hourChange - 12; + if (intervalChange >= 13) + { + intervalChange -= 12; + } + } + timeChange++; + } + STILL BROKEN + + } while (intervalChange > 12); */ + if (intervalChange >= 12) + { + intervalChange = 0; + timeChange++; + } + } + + for (timeChange; timeChange > 1; timeChange--) + { + if (Time == 'A') + { + Time += 15; + foo = true; + } + if (Time == 'P' && !foo) + { + Time -= 15; + } + foo = 0; + } + + if (travel == 'F') + { + hourNew = hourOG + intervalChange; + } + if (travel == 'B') + { + hourNew = hourOG + intervalChange; + } + cout << "The new time is: " << hourNew << " " << Time << "M" << endl; + return 0; +} \ No newline at end of file diff --git a/ee1301/wk2/hw2_directory/strap012_HW2C.cpp b/ee1301/wk2/hw2_directory/strap012_HW2C.cpp new file mode 100644 index 0000000..f300a04 --- /dev/null +++ b/ee1301/wk2/hw2_directory/strap012_HW2C.cpp @@ -0,0 +1,15 @@ +/* +Date: 20 Feb 2019 +Name: Matthew Strapp +Student ID number: 5449340 +Course number: EE1301 +Term: Spring 2019 +Lab/assignment number: Homework 2B +Short Program Description: Time Calculator +*/ + +#include +using namespace std; +int main () { + +} \ No newline at end of file -- cgit v1.2.3