Answer:
void Initials(string firstName,string lastName)
{
cout<<firstName[0];
for(int i=1;i<firstName.length();i++)
{
if(firstName[i-1]==' ')
{
cout<<firstName[i];
}
}
cout<<lastName[0];
for(int i=1;i<lastName.length();i++)
{
if(lastName[i-1]==' ')
{
cout<<lastName[i];
}
}
cout<<endl;
}
Step-by-step explanation:
The above written code is the function Initials which prints the full name.Parameters provided in the function are firstname and lastname in the format of string.You should include string header file for this code to run.