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
51 changes: 25 additions & 26 deletions Project3/Project3/Source.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/*

/*
Ray Chen - Period 1

Three Digit Ascend Descend Selection

3 digit number and find stuff about it.

*/

// Libraries
Expand All @@ -17,15 +14,15 @@ Three Digit Ascend Descend Selection
using namespace std;

//variables
int x;
int A;
int B;
int C;
int x; // number user inputs
int A; // hundreds digit
int B; // tens digit
int C; // ones digit

// Functions()
void pause() {

cout << "Press any key to continue . . .";
cout << "Press any key to check another number . . . \n";

while (!_kbhit());

Expand All @@ -36,21 +33,23 @@ void pause() {

// MAIN
void main() {
cout << "Enter a three digit number. \n";
cin >> x;

A = (x / 100);
B = (x - A * 100) / 10;
C = (x - A * 100 - (B * 10));

if (A < B && B < C) {
cout << "Ascending \n";
}
else if (A > B && B > C) {
cout << "Descending \n";
for (int iguess = 0; iguess < 30; iguess = iguess + 1) {
cout << "Enter a three digit number. \n";
cin >> x;

A = (x / 100);
B = (x - A * 100) / 10;
C = (x - A * 100 - (B * 10));

if (A < B && B < C) {
cout << "Ascending \n";
}
else if (A > B && B > C) {
cout << "Descending \n";
}
else {
cout << "Neither \n";
}
_getch(); // pauses to see the displayed text
}
else {
cout << "Neither \n";
}
pause(); // pauses to see the displayed text
}
}