Created
June 16, 2020 10:03
-
-
Save 2hanX/73fcea2a16a2db01eca0e9397f8c5d53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstring> | |
using namespace std; | |
struct person | |
{ | |
char fname[10]; | |
char lname[10]; | |
}; | |
int main() | |
{ | |
person p; | |
char name[20]; | |
cout << "Enter your first name: "; | |
cin.getline(p.fname,10); | |
cout << "Enter your last name: "; | |
cin.getline(p.lname, 10); | |
strcpy_s(name, p.lname); | |
strcat_s(name, ", "); | |
strcat_s(name, p.fname); | |
cout << "Here's the information in a single string: " << name << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment