Skip to content

Instantly share code, notes, and snippets.

@2hanX
Created June 16, 2020 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2hanX/ae5c0e5db110f219530503bf397ca692 to your computer and use it in GitHub Desktop.
Save 2hanX/ae5c0e5db110f219530503bf397ca692 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<string>
using namespace std;
struct person
{
string fname;
string lname;
};
int main()
{
person p;
string name;
cout << "Enter your first name: ";
getline(cin, p.fname);
cout << "Enter your last name: ";
getline(cin, p.lname);
name = p.lname + ", " + 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