diff --git a/Project6/Project6/Source.cpp b/Project6/Project6/Source.cpp index 6c5f6f1..3fbb17b 100644 --- a/Project6/Project6/Source.cpp +++ b/Project6/Project6/Source.cpp @@ -1,6 +1,6 @@ /* -Colin Durocher - 10/5/2017 - 3 +Colin Durocher - 10/5/2017 - 3 - EDITED BY SAM BRYANT P 2 Assignment Name : Program Problem 3 : Three_Digit_Ascend_Descend_Selection @@ -33,20 +33,36 @@ void pause() { void main() { // Define and Assign your variable(s) - + int Number; + + // Start loop here, to ask for the number 30 times : + + for (int i = 0; i++;) { + - // Display Text - cout << "Type a 3 digit number.\n"; - cin >> Number; - int A = Number / 100; - int B = (Number % 100 ) /10; - int C = (Number % 100) % 10; - if (A < B && B < C) - cout << "your number is asending\n"; - else if (A > B && B > C) - cout << "your number is desending\n"; - else - cout << "your number is not asending and it is not desending\n"; + + // Display Text + cout << "Type a 3 digit number.\n"; + cin >> Number; // Take in number from user + int A = Number / 100; // divide by 100 leaving with the first digit as digit A + int B = (Number % 100) / 10; // mod 10 then divide by ten giving the second digit as B + int C = (Number % 10); // you can actually just do mod 10 and it will work the same with less code. gives last digit as C + if (A < B && B < C) // determine if ascending + cout << Number << " is asending\n"; // Now displays their number + else if (A > B && B > C) //determine if descending + cout << Number << " is desending\n"; // Now displays their number + else // if not any of those it must be neither, so display neither: + cout << Number << " is not asending and it is not desending\n"; // Now displays their number + + // TEST FOR IF I HAS REACHED 30 : + + if (i == 30) { + pause(); // move pause here to end program after it has asked 30 times for the number. + } + + } pause(); // pauses to see the displayed text -} \ No newline at end of file + //end + // EDITED BY SAM BRYANT PERIOD 2 +}