-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSource.cpp
More file actions
56 lines (41 loc) · 897 Bytes
/
Source.cpp
File metadata and controls
56 lines (41 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Ray Chen - Period 1
Three Digit Ascend Descend Selection
3 digit number and find stuff about it.
*/
// Libraries
#include <iostream> // gives access to cin, cout, endl, <<, >>, boolalpha, noboolalpha
#include <conio.h> // gives access to _kbhit() and _getch() for pause()
#include <math.h>
// Namespaces
using namespace std;
//variables
int x;
int A;
int B;
int C;
// Functions()
void pause() {
cout << "Press any key to continue . . .";
while (!_kbhit());
_getch();
cout << '\n';
}
// 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";
}
else {
cout << "Neither \n";
}
pause(); // pauses to see the displayed text
}