Ask Question
27 October, 16:24

A variable like user_num can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 pts) Output the input squared and cubed. Hint: Compute squared as user_num * user_num. (2 pts) Get a second user input into user_num2, and output the sum and product. (1 pt)

+5
Answers (1)
  1. 27 October, 17:00
    0
    The answer to this question is given below in the explanation section. It is noted that this program is written in C+ + using online C+ + compiler.

    Explanation:

    #include

    using namespace std;

    int squared (int num) / / this is the function to compute square

    {

    return num*num;

    }

    int cube (int num) / / this is the function to compute cube

    {

    return num*num*num;

    }

    int main ()

    {

    int user_num, user_num2; / / variable declaration

    cout<<"Enter the first number: "; //prompt user to enter the number

    cin>>user_num; //store the user entered number into variable

    cout<<"/nEnter the second number: "; //prompt the user to enter the second number

    cin>>user_num2; //store the user entered number into variable

    cout<<"/nSquared of first number is: "<
    cout<<"/nCube of first number is: "<
    cout<<"/nSquare of second number is: "<
    cout<<"/nCube of second number is: "<
    cout<<"/nSum of number 1 and number 2 is: "<
    cout<<"/nProduct of number 1 and number 2 is: "<
    return 0; //terminate the program

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “A variable like user_num can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 pts) Output ...” 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