diff --git a/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Three_Digit_Ascend_Descend_Selection.cpp b/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Three_Digit_Ascend_Descend_Selection.cpp index 4c55d0c..e23ecfa 100644 --- a/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Three_Digit_Ascend_Descend_Selection.cpp +++ b/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Colin_Neary_Three_Digit_Ascend_Descent_Selection/Three_Digit_Ascend_Descend_Selection.cpp @@ -6,6 +6,8 @@ Three_Digit_Ascend_Descend_Selection : * Determining order of digits +Modified by Christopher Hartsfield and Jaren Duffield + */ #include @@ -20,29 +22,37 @@ void pause() { cout << '\n'; } -void main() { +int main() +{ + int i = 1; + while (i < 31) + { int x; - cout << "Press any positive three digit number"; + cout << "Press any positive three digit number "; cin >> x; - int a = (x/100) % 10; + int a = (x / 100) % 10; int b = (x / 10) % 10; int c = x % 10; - bool ascending = a!= b && b!= c; + bool ascending = a != b && b != c; bool descending = ascending; - if(a > b) - ascending = false; - else - descending = false; - if(b > c) - ascending = false; - else - descending = false; - if(ascending) - cout << "Ascending \n"; - else if(descending) - cout << "Descending \n"; - else - cout << "Neither "; - - pause(); -} \ No newline at end of file + if (a > b) + ascending = false; + else + descending = false; + if (b > c) + ascending = false; + else + descending = false; + if (ascending) + cout << "The number " << x << " is ascending \n"; + else if (descending) + cout << "The number " << x << " is descending \n"; + else + cout << "The number " << x << " is neither ascending or descending \n"; + i++; + _getch(); + } + return 0; + } + +