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
63 changes: 45 additions & 18 deletions Program Problem 3/Program Problem 3/Problem3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void pause() {

cout << "Press any key to continue . . .";



while (!_kbhit());

Expand All @@ -37,32 +37,59 @@ void pause() {

void main() {

int x;
int x; // make variable names more specific
int A;
int B;
int C;


cout << "Give me a 3-digit number: ";
cin >> x;
cout << "Give me a 3-digit number: ";
cin >> x;


C = x % 10;
B = (x / 10) % 10;
A = (x / 100);

if (A > B && B > C) {
cout << "Descending" << endl;
}

else if (C > B && B > A) {
cout << "Ascending" << endl;
}

else {

cout << "Neither" << endl;
}

C = x % 10;
B = (x / 10) % 10;
A = (x / 100);

if (A > B && B > C) {
cout << "Descending" << endl;
}

else if (C > B && B > A) {
cout << "Ascending" << endl;
}
for (int i = 1; i < 30; i++) {
cout << "Give me a 3-digit number: " << endl;
cin >> x;

else {

cout << "Neither" << endl;
}
C = x % 10;
B = (x / 10) % 10;
A = (x / 100);

if (A > B && B > C) {
cout << "Descending" << endl;
}

else if (C > B && B > A) {
cout << "Ascending" << endl;
}

else {

cout << "Neither" << endl;
}
}



pause(); // pauses to see the displayed text
}
}
}