diff options
Diffstat (limited to 'ee1301/wk1/lab1')
-rw-r--r-- | ee1301/wk1/lab1/strap012_lab1_c_2.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/ee1301/wk1/lab1/strap012_lab1_c_2.cpp b/ee1301/wk1/lab1/strap012_lab1_c_2.cpp index 46efd7e..c39a0c5 100644 --- a/ee1301/wk1/lab1/strap012_lab1_c_2.cpp +++ b/ee1301/wk1/lab1/strap012_lab1_c_2.cpp @@ -4,17 +4,10 @@ using namespace std; int main() { - string first; - string middle; - string last = " "; + string first, last; cout << "What is your full name?" << endl; - cin >> first >> middle >> last; - if (last == " ") - { - cout << middle << ", " << first; - } - else - { - cout << last << ", " << first << " " << middle << endl; + getline + cin >> last; + cout << last << ", " << first << } } |