aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortill-t <[email protected]>2021-11-02 23:46:58 -0700
committertill-t <[email protected]>2021-11-02 23:46:58 -0700
commitba5bfffa005902ff8c6aaf76f26a46f9a20ef8f0 (patch)
tree1b0c548478a81d1c33a419bfecae9a23f6e4187e
parentupdate (diff)
downloadcst116-lab5-till-t-ba5bfffa005902ff8c6aaf76f26a46f9a20ef8f0.tar.xz
cst116-lab5-till-t-ba5bfffa005902ff8c6aaf76f26a46f9a20ef8f0.zip
complete mod_10a
-rw-r--r--mod_10a/main.cpp3
-rw-r--r--mod_10a/source.cpp21
-rw-r--r--mod_10a/source.h2
3 files changed, 13 insertions, 13 deletions
diff --git a/mod_10a/main.cpp b/mod_10a/main.cpp
index cde2050..bab1b81 100644
--- a/mod_10a/main.cpp
+++ b/mod_10a/main.cpp
@@ -2,7 +2,6 @@
int main() {
getName();
-
-
+
return 0;
}
diff --git a/mod_10a/source.cpp b/mod_10a/source.cpp
index 32a1cec..5b6b015 100644
--- a/mod_10a/source.cpp
+++ b/mod_10a/source.cpp
@@ -4,22 +4,23 @@
*/
#include "source.h"
-
-
-void getName();
+
+
+void getName()
{
char name[50];
char lastname[50];
char fullname[100]; // Big enough to hold both name and lastname
-
- cout<<"Please enter your name: ";
+
+
+ cout<<"Please enter your first name: ";
cin.getline ( name, 50 );
cout<<"Enter your last name: ";
cin.getline ( lastname, 50 );
fullname[0] = '\0'; // strcat searches for '\0' to cat after
- strcat ( fullname, name ); // Copy name into full name
- strcat ( fullname, " " ); // We want to separate the names by a space
- strcat ( fullname, lastname ); // Copy lastname onto the end of fullname
+ strcat ( fullname, lastname ); // Copy name into full name
+ strcat ( fullname, ", " ); // We want to separate the names by a space
+ strcat ( fullname, name ); // Copy lastname onto the end of fullname
cout<<"Your full name is "<< fullname <<"\n";
- cin.get();
-}
+
+}
diff --git a/mod_10a/source.h b/mod_10a/source.h
index ab77514..61e8b75 100644
--- a/mod_10a/source.h
+++ b/mod_10a/source.h
@@ -9,5 +9,5 @@
using namespace std;
int main();
-getName();
+void getName();