//OrinTill Qimid CS1A Chapter 4, P. 294, 10
//
/**************************************************************
 * Name Formates
 * 
 * ____________________________________________________________
 *This program will format the entered names.
 * ____________________________________________________________
 * INPUT
 * User name
 * OUTPUT
 * formatted names.
 **************************************************************/
#include <iostream>
#include <cstring>

using namespace std;

int main() {
    // Define arrays to store names
    const int SIZE = 50; // Maximum size for each name
    char firstName[SIZE];
    char middleName[SIZE];
    char lastName[SIZE];
    char fullName[3 * SIZE]; // Array to store the formatted full name

    // Prompt user for their first, middle, and last names
    cout << "Enter your first name: ";
    cin.getline(firstName, SIZE);

    cout << "Enter your middle name: ";
    cin.getline(middleName, SIZE);

    cout << "Enter your last name: ";
    cin.getline(lastName, SIZE);

    // Construct the formatted name
    strcpy(fullName, lastName);             // Copy last name
    strcat(fullName, ", ");                 // Add a comma and space
    strcat(fullName, firstName);            // Add first name
    strcat(fullName, " ");                  // Add a space
    strcat(fullName, middleName);           // Add middle name

    // Display the result
    cout << "Formatted name: " << fullName << endl;
    return 0;
}