firstName is assigned "Tom" and the lastName is input from user
and im having trouble using fullName = firstName + " " + lastName;
i remember the professor saying it wasn't allowed in c_strings
but i dont remember the proper way to do it.
#include <iostream>
#include <string>
using namespace std;
int main()
{
char firstName[10] = "Tom";
char lastName[10];
char fullName[20];
int age;
cout << "Enter your age: ";
cin >> age;
cout << "\nEnter the last name: ";
cin.getline(lastName, 10);
//fullName = firstName + " " + lastName;
cout << "\n\nHello " << fullName << " .";
cout << "You are " << age << " years old." << "\n";
when using c-strings you have to cater for the null terminated character as well - functions like strcpy and strcat will usually fail if a c-string is not NULL terminated properly.