Ask Question
27 June, 15:38

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. 27 June, 17:26
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers