-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProblem3.cpp
More file actions
68 lines (39 loc) · 1004 Bytes
/
Problem3.cpp
File metadata and controls
68 lines (39 loc) · 1004 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
57
58
59
60
61
62
63
64
65
66
67
68
/*
Nikhil Goyle - 10/5/17 2
Program Problem 3 : *
Determine whether a number is ascending or descending
*/
// Libraries
#include <iostream> // gives access to cin, cout, endl, <<, >>, boolalpha, noboolalpha
#include <conio.h> // gives access to _kbhit() and _getch() for pause()
// Namespaces
using namespace std;
// Functions()
void pause() {
cout << "Press any key to continue . . .";
while (!_kbhit());
_getch();
cout << '\n';
}
// MAIN
void main() {
int x;
int A;
int B;
int C;
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 << "The number " << A << B << C << " is Descending" << endl;
}
else if (C > B && B > A) {
cout << "The number " << A << B << C << " is Ascending" << endl;
}
else {
cout << "The number " << A << B << C << " is Neither" << endl;
}
pause(); // pauses to see the displayed text
}