Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions Project6/Project6/Source.cpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
}
//end
// EDITED BY SAM BRYANT PERIOD 2
}