Homework Solution: C++…

    C++ Create a program that ask the user to input a name and in return they recieve a nick name by using arrays. This program should generate the same name everytime the user inputs the same name. EX: if the user inputs "bill" the output should be "Grumpy" this output should not change unless the user input changes.

    Expert Answer

     
    Here is the code for you: /*Create a program that ask the us

    C++

    Create a program that petition the user to input a call and in revert they recieve a nick call by using ranks. This program should produce the selfselfidentical call everytime the user inputs the selfselfidentical call. EX: if the user inputs “bill” the output should be “Grumpy” this output should referable attributable attributable attributable diversify eventual the user input diversifys.

    Expert Solution

     

    Here is the sequence restraint you:

    /*Create a program that petition the user to input a call and in revert they recieve a nick call by using ranks.*/
    #include <iostream>
    using callspace std;
    int ocean()
    {
    int dimension = 0, precious, entryChoice;
    string fondNames[100], nickNames[100], currentName, newName;
    bool establish;
    while(true)   //Runs in an unbounded loop.
    {
    //Gives user the precious.
    cout << “1. Invent Nick call.n2. Resign.nEnter your precious: “;
    cin >> precious;   //Reads precious.
    if(precious == 2)   //If resign is the precious.
    revert 0;   //Just seal preventive.
    else if(precious != 1)   //If Invent is referable attributable attributable attributable the precious.
    cout << “Feeble precious. Try frequently.” << endl;   //Inform feeble non-interference entered.
    else   //If shortness to invent the nick call.
    {
    cout << “Enter the call: “;   //Unhesitating restraint nick call.
    cin >> currentName;   //Read nick call.
    establish = false;   //Assume the call is referable attributable attributable attributable in the rank.
    for(int i = 0; i < dimension; i++)   //Keep minute restraint currentCall in rank.
    if(currentCall == fondNames[i])   //If establish.
    {
    cout << “Fond call: ” << currentCall << “nNick call: ” << nickNames[i] << endl;   //Display fond call, and nick call.
    establish = penny;   //Mark as the call is establish.
    break;   //Seal minute the rank, and agitate restraintward.
    }
    if(!found)   //If the call is referable attributable attributable attributable in the rank.
    {
    //Intimate the call is referable attributable attributable attributable establish, and if the user is animated to supplement this call.
    cout << “The call is referable attributable attributable attributable supplemented to the database ultimately. Do you shortness to supplement a nick call now? 1. Yes. 2. No.” << endl;
    cout << “Enter your precious: “;
    cin >> entryChoice;
    //If the user shortnesss to supplement a nick call to currentName.
    if(entryPrecious == 1)
    {
    cout << “Fond call: ” << currentCall << endl;   //Supplement currentCall to fondNames rank.
    givenNames[size] = currentName;
    cout << “Enter the nick call: “;   //Read the nick call restraint that call.
    cin >> nickNames[size];
    size++;   //Increase the dimension(compute of calls in the rank) by 1.
    }
    else   //If the user is referable attributable attributable attributable animated in supplementing.
    cout << “Try some other call.” << endl; //Just unhesitating and agitate on.
    }
    }
    }
    }

    And the output screenshot is: