From 9acd7c5a05bb8fbdb94a9ced819a3a4215dcfb0a Mon Sep 17 00:00:00 2001 From: jtschuebel <31863902+jtschuebel@users.noreply.github.com> Date: Thu, 12 Oct 2017 13:38:28 -0500 Subject: [PATCH] Added loop --- ThreeDigit.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ThreeDigit.cpp b/ThreeDigit.cpp index 9caf505..2172b52 100644 --- a/ThreeDigit.cpp +++ b/ThreeDigit.cpp @@ -35,7 +35,7 @@ void pause() { void main() { int number; // X is a three digit number - int digit_a; // hundreds place + int digit_a; // hundreds place //delete the digit so its easier to read- JT int digit_b; // tens place int digit_c; // ones place @@ -58,7 +58,27 @@ void main() { cout << "neither"; } + while( x < 30){ + cout << "Choose a 3 Digit number:" << endl; + cin >> number; + digit_a = number / 100; + digit_b = (number % 100) / 10; + digit_c = number % 10; + + if (digit_a > digit_b && digit_b > digit_c) { + cout << "descending"; +} + else if (digit_a < digit_b && digit_b < digit_c) { + + cout << "ascending"; + + } + else { + + cout << "neither"; + } + } pause(); @@ -67,4 +87,4 @@ pause(); pause(); // pauses to see the displayed text -} \ No newline at end of file +}