blob: e03f5acc9f36f6cd434dc822586bc4c552abb10c (
plain) (
blame)
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
|
#include <iostream>
using namespace std;
//Function decleration/prototype
//Functions are created in order from top to bottom
double larger(double x, double y);
double threelarger(double x, double y, double z);
int main() {
double num1, num2, num3;
cout << "find the largest of two numbers \n\n";
cout << "enter number 1: ";
cin >> num1;
cout << "enter number 2: ";
cin >> num2;
cout << "enter number 2: ";
cin >> num3;
answer = threelarger(num1, num2, num3);
cout << "the largest of the three numbers you entered is: " << larger(num1,num2) << endl;
}
double threelarger (double x, double y) {
double max;
if (x > y) {
max = x;
} else {
max = y;
}
return max;
}
double larger (double x, double y) {
return larger(x, larger(y,z));
}
|