Hello,
I am trying to use a string to convert a person's name to be in this format last name followed by a comma followed by the rest of the name. "Last name" is determined to be everything after a space. This is what I have so far. I would greatly appreciate any help.
string lastNameFirst(string name)
{
string firstname;
string lastname;
for (int i = 0; i < name.length(); i++)
{
if (name[i] !== '')
word
}
Hello. Yes that is what I have. I was wondering how to make it output those names like it says in the parentheses. If you would help. I would greatly appreciate it.
as you can see, I fit everything into the main function. Unless you are using this to make a much bigger program or put the result as a string, there is no need for a separate function. You can also remove the "cin's" if you yourself want to add the name in. PM me if you need more help