From 6c83506cb44b1d20f66df404f0b6468b0e291b6b Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 25 Jun 2019 17:55:13 -0500 Subject: Do a thing: --- ee1301/wk5/lab4/partner.cpp | 104 ++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'ee1301/wk5/lab4/partner.cpp') diff --git a/ee1301/wk5/lab4/partner.cpp b/ee1301/wk5/lab4/partner.cpp index 3313e8c..538163d 100644 --- a/ee1301/wk5/lab4/partner.cpp +++ b/ee1301/wk5/lab4/partner.cpp @@ -1,52 +1,52 @@ -#include - -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; -} - +#include + +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; +} + -- cgit v1.2.3