aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk5/lab4/partner2.cpp
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-03-27 12:33:52 -0500
committerRossTheRoss <msattr@gmail.com>2019-03-27 12:33:52 -0500
commit42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5 (patch)
treefb507cfea88fd54b2078f60f3f5935c62685d502 /ee1301/wk5/lab4/partner2.cpp
parentUpload bad thing (diff)
downloadhomework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar.gz
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar.bz2
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar.lz
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar.xz
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.tar.zst
homework-42cd39b0f8ddda09c3d4bb590f61450bf6c2b0f5.zip
Post-Spring Lab
Diffstat (limited to '')
-rw-r--r--ee1301/wk5/lab4/partner2.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/ee1301/wk5/lab4/partner2.cpp b/ee1301/wk5/lab4/partner2.cpp
new file mode 100644
index 0000000..3313e8c
--- /dev/null
+++ b/ee1301/wk5/lab4/partner2.cpp
@@ -0,0 +1,52 @@
+#include <iostream>
+
+using namespace std;
+
+string requestName();
+double requestHeight(string fullName);
+int requestNumberOfPartners();
+
+
+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]);
+
+ cout << "If " << fullName[0] << " and " << fullName[1]
+ << " form a human tower, their combined height will be "
+ << (height[0] + height[1]) << endl;
+
+}
+
+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;
+}
+