summaryrefslogtreecommitdiffstats
path: root/C++/FindLargestNumber/FindLargestNumber.cpp
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
committermsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
commit9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch)
treeeb1efc1d028b949dd83bb710c68be8eff58f26e7 /C++/FindLargestNumber/FindLargestNumber.cpp
downloadschool-code-master.tar.gz
school-code-master.tar.bz2
school-code-master.zip
Inital CommitHEADmaster
Diffstat (limited to 'C++/FindLargestNumber/FindLargestNumber.cpp')
-rw-r--r--C++/FindLargestNumber/FindLargestNumber.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/C++/FindLargestNumber/FindLargestNumber.cpp b/C++/FindLargestNumber/FindLargestNumber.cpp
new file mode 100644
index 0000000..e03f5ac
--- /dev/null
+++ b/C++/FindLargestNumber/FindLargestNumber.cpp
@@ -0,0 +1,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));
+}