C++ Program to Print Full Name of User

In this program, the use will enter his/her first name and last name, then the full name will be displayed on console.



Source Code
#include<iostream>
using namespace std;
#include<string.h>

int main()
{
    char fname[40], lname[20];

    cout<<"Enter your First name: ";
    cin>> fname;
    cout<<"Enter your Last name: ";
    cin>> lname;

    strcat(fname, lname);
    cout<<"Hello, " << fname;
    return 0;
}
Output
Enter your First name: John
Enter your Last name: Smith
Hello, JohnSmith