Ask Question
1 December, 10:18

Write c+ + function that receives input a person's first name and surname, and then just displays the initials. For example: John Peter Joe, the initials JPJ must be displayed

+4
Answers (1)
  1. 1 December, 13:14
    0
    void Initials (string firstName, string lastName)

    {

    cout<
    for (int i=1; i
    {

    if (firstName[i-1]==' ')

    {

    cout<
    }

    }

    cout<
    for (int i=1; i
    {

    if (lastName[i-1]==' ')

    {

    cout<
    }

    }

    cout<
    }

    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write c+ + function that receives input a person's first name and surname, and then just displays the initials. For example: John Peter ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers