diff options
Diffstat (limited to 'mod_10a/source.cpp')
| -rw-r--r-- | mod_10a/source.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
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(); -} + +} |