forked from zmercury/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreatestNum.cpp
More file actions
38 lines (32 loc) · 890 Bytes
/
greatestNum.cpp
File metadata and controls
38 lines (32 loc) · 890 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
#include <iostream>
using namespace std;
class greatestNum {
public:
void findGreatest(int &x,int &y,int &z) {
if(x > y) {
if(x > z) {
cout << x << " is greater!" << endl;
} else {
cout << z << " is greater!" << endl;
}
} else {
if(y > z) {
cout << y << " is greater!" << endl;
} else {
cout << z << " is greater!" << endl;
}
}
}
};
int main() {
greatestNum n1;
int numOne;
int numTwo;
int numThree;
cout << "Enter any three number: ";
cin >> numOne;
cin >> numTwo;
cin >> numThree;
n1.findGreatest(numOne,numTwo,numThree);
return 0;
}