diff --git a/Program Problem 3/Program Problem 3/Source.cpp b/Program Problem 3/Program Problem 3/Source.cpp index 4d6bfdb..e0ee2fa 100644 --- a/Program Problem 3/Program Problem 3/Source.cpp +++ b/Program Problem 3/Program Problem 3/Source.cpp @@ -5,7 +5,7 @@ Three Digit Ascending and Descending Selection #include #include -#include + using namespace std; @@ -22,31 +22,47 @@ void pause() { void main() { int three_digit_number; - cout << "Enter a three digit number, "; - Sleep(2000); cout << "please. : "; cin >> three_digit_number; - int x = three_digit_number; - int A = x / 100; - int B = (x / 10) % 10; - int C = x % 10; + //don't try to change the variable name, it could confuse you later on; stick to the specific variable name you've already given + int A = three_digit_number / 100; + int B = (three_digit_number / 10) % 10; + int C = three_digit_number % 10; if (A < B && B < C) { cout << "Ascending..." << endl; - Sleep(2000); } else if (A > B && B > C) { cout << "Descending..." << endl; - Sleep(2000); } else { cout << "Neither..." << endl; - Sleep(2000); } + + for (int i = 1; i < 30; i++) { + cout << "Enter a three digit number, "; + cout << "please. : "; + cin >> three_digit_number; + + int A = three_digit_number / 100; + int B = (three_digit_number / 10) % 10; + int C = three_digit_number % 10; + + if (A < B && B < C) { + cout << "Ascending..." << endl; + } + else if (A > B && B > C) { + cout << "Descending..." << endl; + } + else { + cout << "Neither..." << endl; + } + } + pause(); -} \ No newline at end of file +}