aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk5/lab4/partner2.cpp
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2022-05-24 11:18:46 -0500
committerMatt Strapp <matt@mattstrapp.net>2022-05-24 11:19:55 -0500
commit7a73162607544204032aa66cce755daf21edebda (patch)
tree58578e01f15f34a855d99c32898db9d7a1603e67 /ee1301/wk5/lab4/partner2.cpp
parentdo some stuff (diff)
downloadhomework-7a73162607544204032aa66cce755daf21edebda.tar
homework-7a73162607544204032aa66cce755daf21edebda.tar.gz
homework-7a73162607544204032aa66cce755daf21edebda.tar.bz2
homework-7a73162607544204032aa66cce755daf21edebda.tar.lz
homework-7a73162607544204032aa66cce755daf21edebda.tar.xz
homework-7a73162607544204032aa66cce755daf21edebda.tar.zst
homework-7a73162607544204032aa66cce755daf21edebda.zip
Graduate
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'ee1301/wk5/lab4/partner2.cpp')
-rw-r--r--ee1301/wk5/lab4/partner2.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/ee1301/wk5/lab4/partner2.cpp b/ee1301/wk5/lab4/partner2.cpp
new file mode 100644
index 0000000..2b6bd36
--- /dev/null
+++ b/ee1301/wk5/lab4/partner2.cpp
@@ -0,0 +1,53 @@
+#include <iostream>
+
+using namespace std;
+
+string requestName();
+double requestHeight(string fullName);
+int requestNumberOfPartners();
+void NotinMain(string fullName[], const int length1, double height[], const int length2);
+
+int main()
+{
+ string fullName[2]; //fullName1, fullName2;
+ double height[2]; //height1, height2;
+
+ fullName[0] = requestName();
+ height[0] = requestHeight(fullName[0]);
+ fullName[1] = requestName();
+ height[1] = requestHeight(fullName[1]);
+ NotinMain(fullName, 2, height, 2);
+}
+
+string requestName()
+{
+ string name;
+ cout << "Please enter full name: ";
+ getline(cin, name);
+ return name;
+}
+
+double requestHeight(string fullName)
+{
+ double height;
+ cout << "Please enter " << fullName << "'s height: ";
+ cin >> height;
+ cin.ignore(2, '\n'); // gets rid of \n in the buffer
+
+ return height;
+}
+
+int requestNumberOfPartners()
+{
+ int numberOfPartners;
+ cout << "How many partners are there?";
+ cin >> numberOfPartners;
+
+ return numberOfPartners;
+}
+
+void NotinMain(string fullName[], const int length1, double height[], const int length2) {
+ cout << "If " << fullName[0] << " and " << fullName[1]
+ << " form a human tower, their combined height will be "
+ << (height[0] + height[1]) << endl;
+ } \ No newline at end of file