diff options
-rwxr-xr-x | ee1301/wk5/lab4/cmd-test | bin | 0 -> 28920 bytes | |||
-rw-r--r-- | ee1301/wk5/lab4/pOc.cpp | 12 | ||||
-rw-r--r-- | ee1301/wk5/lab4/partner2.cpp | 13 |
3 files changed, 19 insertions, 6 deletions
diff --git a/ee1301/wk5/lab4/cmd-test b/ee1301/wk5/lab4/cmd-test Binary files differnew file mode 100755 index 0000000..2e0e631 --- /dev/null +++ b/ee1301/wk5/lab4/cmd-test diff --git a/ee1301/wk5/lab4/pOc.cpp b/ee1301/wk5/lab4/pOc.cpp new file mode 100644 index 0000000..93dbb06 --- /dev/null +++ b/ee1301/wk5/lab4/pOc.cpp @@ -0,0 +1,12 @@ +#include <iostream> +using namespace std; + +int main(int argc, char* argv[]) { + + int i; + cout << "You typed the following on the command line:" << endl; + for (i = 0; i < argc ; i++) { + cout << argv[i] << ", "; + } + cout << endl; +} diff --git a/ee1301/wk5/lab4/partner2.cpp b/ee1301/wk5/lab4/partner2.cpp index 3313e8c..ef0958c 100644 --- a/ee1301/wk5/lab4/partner2.cpp +++ b/ee1301/wk5/lab4/partner2.cpp @@ -5,7 +5,7 @@ using namespace std; string requestName(); double requestHeight(string fullName); int requestNumberOfPartners(); - +void NotinMain(string array1[], const int length1, double array2[], const int length2); int main() { @@ -16,11 +16,7 @@ int main() 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; - + NotinMain(fullName, 2, height, 2); } string requestName() @@ -50,3 +46,8 @@ int requestNumberOfPartners() return numberOfPartners; } +void NotinMain(string array1[], const int length1, double array2[], const int length2) { + cout << "If " << array1[0] << " and " << array1[1] + << " form a human tower, their combined height will be " + << (array2[0] + array2[1]) << endl; + }
\ No newline at end of file |