diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-16 17:22:10 +0000 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-16 17:22:10 +0000 |
commit | b01e1bfd8742d149c0f6a2d203b669136e83b7d1 (patch) | |
tree | 3a53310b61286d97401e5243a277f8fd6e778b79 /ee1301/wk2 | |
parent | Add lecture example (diff) | |
download | homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar.gz homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar.bz2 homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar.lz homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar.xz homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.tar.zst homework-b01e1bfd8742d149c0f6a2d203b669136e83b7d1.zip |
Infuriating for loops are infuriating
Diffstat (limited to 'ee1301/wk2')
-rw-r--r-- | ee1301/wk2/hw2_directory/strap012_2A.cpp | 47 | ||||
-rw-r--r-- | ee1301/wk2/hw2_directory/strap012_2B.cpp | 15 | ||||
-rw-r--r-- | ee1301/wk2/hw2_directory/strap012_2C.cpp | 15 |
3 files changed, 77 insertions, 0 deletions
diff --git a/ee1301/wk2/hw2_directory/strap012_2A.cpp b/ee1301/wk2/hw2_directory/strap012_2A.cpp new file mode 100644 index 0000000..9940bd6 --- /dev/null +++ b/ee1301/wk2/hw2_directory/strap012_2A.cpp @@ -0,0 +1,47 @@ +/* +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 <iostream> +using namespace std; +int main () { + int countOG= 0, i=0, j=0; + +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<count; j++) { + cout << i; + } + count++; + cout << endl; + } + } +} while (countOG != 0); + cout << "Goodbye." << endl; + return 0; +}
\ No newline at end of file diff --git a/ee1301/wk2/hw2_directory/strap012_2B.cpp b/ee1301/wk2/hw2_directory/strap012_2B.cpp new file mode 100644 index 0000000..02b5f7b --- /dev/null +++ b/ee1301/wk2/hw2_directory/strap012_2B.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: Pay Stub Calculator +*/ + +#include <iostream> +using namespace std; +int main () { + +}
\ No newline at end of file diff --git a/ee1301/wk2/hw2_directory/strap012_2C.cpp b/ee1301/wk2/hw2_directory/strap012_2C.cpp new file mode 100644 index 0000000..6cfcb5a --- /dev/null +++ b/ee1301/wk2/hw2_directory/strap012_2C.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 2C +Short Program Description: Pay Stub Calculator +*/ + +#include <iostream> +using namespace std; +int main () { + +}
\ No newline at end of file |