diff options
| author | till-t <[email protected]> | 2021-11-02 23:19:57 -0700 |
|---|---|---|
| committer | till-t <[email protected]> | 2021-11-02 23:19:57 -0700 |
| commit | efb5378904d824407e24247b19fdeb4f0eea9475 (patch) | |
| tree | 91810de53de404cc3af99144f81e02e5512408e7 /mod_10b | |
| parent | Folder for last lab question. Incomplete. (diff) | |
| download | archived-cst116-lab5-till-t-efb5378904d824407e24247b19fdeb4f0eea9475.tar.xz archived-cst116-lab5-till-t-efb5378904d824407e24247b19fdeb4f0eea9475.zip | |
update
Diffstat (limited to 'mod_10b')
| -rw-r--r-- | mod_10b/main.cpp | 22 | ||||
| -rw-r--r-- | mod_10b/source.cpp | 19 | ||||
| -rw-r--r-- | mod_10b/source.h | 13 |
3 files changed, 51 insertions, 3 deletions
diff --git a/mod_10b/main.cpp b/mod_10b/main.cpp index 489c45a..92605e8 100644 --- a/mod_10b/main.cpp +++ b/mod_10b/main.cpp @@ -1 +1,21 @@ -main +/*Tyler Taormina + * CST 116 + * cStrings problem First/Last name + * + */ + +#include "source.h" + + +int main() +{ + char Firstname = [50]; + char Lname = [50]; + char Fullname= [100]; + + getFullName(Firstname, Lname, Fullname); + + return 0; +} + + diff --git a/mod_10b/source.cpp b/mod_10b/source.cpp index 5a18cd2..3c6b551 100644 --- a/mod_10b/source.cpp +++ b/mod_10b/source.cpp @@ -1 +1,18 @@ -source +/*Tyler Taormina + * Source.cpp + */ +#include "source.h" + +vold getFullName(char& first, char& last, char& full) +{ + cout<<"Please enter your First name: "; + cin.getline ( first, 50 ); + cout<<"Enter your last name: "; + cin.getline ( last, 50 ); + full[0] = '\0'; // strcat searches for '\0' to cat after + strcat ( full, first); // Copy name into full name + strcat ( full, " " ); // We want to separate the names by a space + strcat ( full, last); // Copy lastname onto the end of fullname + cout<<"Your full name is "<< full <<"\n"; + cin.get(); +} diff --git a/mod_10b/source.h b/mod_10b/source.h index 8e83f89..fe51602 100644 --- a/mod_10b/source.h +++ b/mod_10b/source.h @@ -1 +1,12 @@ -header + +#include <iostream> //For cout +#include <cstring> //For the string functions + +using namespace std; + +int main(); +void getFullName(char&, char&, char&); + + + + |