aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
diff options
context:
space:
mode:
authoraustinsworld15 <[email protected]>2021-10-19 18:59:06 -0700
committerGitHub <[email protected]>2021-10-19 18:59:06 -0700
commit2c3347ad44f82d8db2d78b48a05e8ab5e61b15be (patch)
tree01c82440d3ed747d3f3df34952065291ee98ee89 /CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
parentUpdate CST116F2021-Lab3-Guertin.cpp (diff)
downloadcst116-lab3-austinsworld15-2c3347ad44f82d8db2d78b48a05e8ab5e61b15be.tar.xz
cst116-lab3-austinsworld15-2c3347ad44f82d8db2d78b48a05e8ab5e61b15be.zip
Update CST116F2021-Lab3-Guertin.cpp
Diffstat (limited to 'CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp')
-rw-r--r--CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
index 1074279..10aa010 100644
--- a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
+++ b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp
@@ -302,4 +302,51 @@ int main()
1.
+#include <iostream>
+#include<iomanip>
+#include <stdlib.h>
+#include <thread>
+#include <string>
+using std::cout;
+using std::endl;
+using std::string;
+
+int main()
+{
+ int count;
+ int converted_to_even;
+
+
+ cout << "Input any number between 1 and 50:\n\n";
+ std::cin >> count;
+
+
+ if (count >= 1 && count <= 50)
+ {
+ cout << "\n\nCounting down the even numbers to 0:\n\n";
+ }
+ else
+ do {
+ cout << "\n\nERROR, this number is not between 1 and 50, please enter a number between 1 and 50\n\n";
+ std::cin >> count;
+ }
+
+ while (count > 50 || count < 1);
+
+
+ if (count % 2 == 1)
+ {
+ converted_to_even = count - 1;
+ }
+ else
+ {
+ converted_to_even = count;
+ }
+
+ while (converted_to_even >= 0)
+ {
+ cout << converted_to_even << endl;
+ converted_to_even -= 2;
+ }
+}