diff options
| author | austinsworld15 <[email protected]> | 2021-10-19 18:17:03 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-19 18:17:03 -0700 |
| commit | 60cd176f1a75f791a6cdb107504c905b1d306382 (patch) | |
| tree | 33f86d066b2a03d34e57301a51bf177ccdc15681 | |
| parent | Update CST116F2021-Lab3-Guertin.cpp (diff) | |
| download | cst116-lab3-austinsworld15-60cd176f1a75f791a6cdb107504c905b1d306382.tar.xz cst116-lab3-austinsworld15-60cd176f1a75f791a6cdb107504c905b1d306382.zip | |
Update CST116F2021-Lab3-Guertin.cpp
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp index 510dc33..1074279 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3-Guertin.cpp @@ -252,5 +252,54 @@ 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; + bool even; + bool odd; + + 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 + { + cout << "\n\nThis number is not a number between 1 and 50, try again.\n\n"; + return (0); + } + + 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; + } +} + +8.3 pg 179 #1 + +1. |