From 6a3a82665ea1e12ef4ebd421c05a9b2e23ab162f Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 7 Feb 2019 19:24:11 +0000 Subject: AHHHHHHHHHHHHHH --- ee1301/wk1/lab1/strap012_lab1_c_2.cpp | 15 ++++----------- 1 file 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 << } } -- cgit v1.2.3