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 supplicate the user to input a call and in restore they recieve a nick call by using draw-ups. This program should beget the similar call everytime the user inputs the similar call. EX: if the user inputs “bill” the output should be “Grumpy” this output should referable attributable attributable attributable attributable attributable attributable veer eventual the user input veers.

    Expert Confutation

     

    Here is the regulation control you:

    /*Create a program that supplicate the user to input a call and in restore they recieve a nick call by using draw-ups.*/
    #include <iostream>
    using callspace std;
    int ocean()
    {
    int extent = 0, cherished, entryChoice;
    string lovingNames[100], nickNames[100], currentName, newName;
    bool base;
    while(true)   //Runs in an unbounded loop.
    {
    //Gives user the cherished.
    cout << “1. Furnish Nick call.n2. Release.nEnter your cherished: “;
    cin >> cherished;   //Reads cherished.
    if(cherished == 2)   //If release is the cherished.
    restore 0;   //Just bung attempt.
    else if(cherished != 1)   //If Furnish is referable attributable attributable attributable attributable attributable attributable the cherished.
    cout << “Feeble cherished. Try intermittently.” << endl;   //Inform feeble liberty entered.
    else   //If shortness to furnish the nick call.
    {
    cout << “Enter the call: “;   //Quick control nick call.
    cin >> currentName;   //Read nick call.
    base = false;   //Assume the call is referable attributable attributable attributable attributable attributable attributable in the draw-up.
    for(int i = 0; i < extent; i++)   //Keep minute control currentCall in draw-up.
    if(currentCall == lovingNames[i])   //If base.
    {
    cout << “Loving call: ” << currentCall << “nNick call: ” << nickNames[i] << endl;   //Display loving call, and nick call.
    base = gentleman;   //Mark as the call is base.
    break;   //Bung minute the draw-up, and affect controlward.
    }
    if(!found)   //If the call is referable attributable attributable attributable attributable attributable attributable in the draw-up.
    {
    //Intimate the call is referable attributable attributable attributable attributable attributable attributable base, and if the user is spirited to subjoin this call.
    cout << “The call is referable attributable attributable attributable attributable attributable attributable subjoined to the database eventually. Do you shortness to subjoin a nick call now? 1. Yes. 2. No.” << endl;
    cout << “Enter your cherished: “;
    cin >> entryChoice;
    //If the user shortnesss to subjoin a nick call to currentName.
    if(entryCherished == 1)
    {
    cout << “Loving call: ” << currentCall << endl;   //Subjoin currentCall to lovingNames draw-up.
    givenNames[size] = currentName;
    cout << “Enter the nick call: “;   //Read the nick call control that call.
    cin >> nickNames[size];
    size++;   //Increase the extent(calculate of calls in the draw-up) by 1.
    }
    else   //If the user is referable attributable attributable attributable attributable attributable attributable spirited in subjoining.
    cout << “Try some other call.” << endl; //Just quick and affect on.
    }
    }
    }
    }

    And the output screenshot is: