diff --git a/Three Digit Project/Three Digit Project/Three_Digit_Ascend_Descend_Selection.cpp b/Three Digit Project/Three Digit Project/Three_Digit_Ascend_Descend_Selection.cpp index ae2a75d..44ad096 100644 --- a/Three Digit Project/Three Digit Project/Three_Digit_Ascend_Descend_Selection.cpp +++ b/Three Digit Project/Three Digit Project/Three_Digit_Ascend_Descend_Selection.cpp @@ -1,11 +1,9 @@ -/* William Chen, Evan Graham, Brian Te - Period 4 - October 5, 2017 - -Assignment Name : Three Digit Ascending Descending Selection - -Let a user enter a three-digit number and the output will either read ascending or descending depending on the order of the characters in value. +/* William Chen, Evan Graham, Brian Te +Period 4 +October 5, 2017 +Assignment Name : Three Digit Ascending Descending Selection +Let a user enter a three-digit number and the output will either read ascending or descending depending on the order of the characters in value. */ // Libraries @@ -35,6 +33,7 @@ void pause() { void main() { int number; + for (int i = 1; i <= 30; i++) { // 30x loop cout << "…………………▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄" << endl; cout << "……………▄▄█▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓█▄▄" << endl; cout << "…………▄▀▀▓▒░░░░░░░░░░░░░░░░▒▓▓▀▄" << endl; @@ -74,27 +73,28 @@ void main() { cout << "………………………..▀▀██▓▓▓▓██▀" << endl; cout << endl; cout << endl; - cout << "You've been spooked by the spookedly skeletor! Please input a three digit number in order to save your pathetic life!" << endl; + cout << "You've been spooked by the spookedly skeletor! Please input a three digit number in order to save your pathetic life!" << endl; // Message displayed to spook the user cout << endl; cin >> number; cout << endl; - int A = number / 100; - int B = (number % 100) / 10; - int C = (number % 100) % 10; - - - if ((A > B) && (B > C)) { - cout << "Descending to Hell!" << endl; - cout << endl; -} - - else if ((A < B) && (B < C)) { - cout << "Ascending to Heaven!" << endl; - cout << endl; + int A = number / 100; // Shows the number in the hundreds place + int B = (number % 100) / 10; // Shows the number in the tens place + int C = (number % 100) % 10; //Shows the number in the ones place + + + if ((A > B) && (B > C)) { + cout << number << " is descending" << endl; // Message displayed if the numbers are descending + cout << endl; + } + + else if ((A < B) && (B < C)) { + cout << number << " is ascending" << endl; // Message displayed if the numbers are ascending + cout << endl; + } + else { + cout << number << " is neither" << endl; //Message displayed if neither ascending or descending + cout << endl; + } } - else { - cout << "No judgement" << endl; - cout << endl; - } - pause(); // pauses to see the displayed text -} \ No newline at end of file + pause(); // Pause to see the displayed text +}