1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natita [175]
4 years ago
9

A variable like user_num can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 p

ts) 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)
Computers and Technology
1 answer:
lapo4ka [179]4 years ago
7 0

Answer:

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 <iostream>

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: "<<squared(user_num);//compute square of user_num and display

   cout<<"\nCube of first number is: "<<cube(user_num);//compute the cube of the user_num and display

   cout<<"\nSquare of second number is: "<<squared(user_num2);//compute the square of user_num2 and display

   cout<<"\nCube of second number is: "<<cube(user_num2);//compute the cube of user_num2 and display

   

   cout<<"\nSum of number 1 and number 2 is: "<<user_num2 + user_num2;//display the sum of user_num2 and user_num

   cout<<"\nProduct of number 1 and number 2 is: "<<user_num2 * user_num;//display the product of user_num and user_num2

   

   

   return 0;//terminate the program

}

                               

You might be interested in
Who like anime becus i dooooo ( wrote this becuse i forgot what i was writing abot)
mars1129 [50]

Answer:

My bestie loves Animes...... I don't watch anime But good at drawing anime(◠‿◕)

4 0
3 years ago
How can I get a refund of my money back
irakobra [83]

Say you got a dress from Macys but you dont like or it doesnt fit whitin 30 days usally you can take it back(with receipt . Most of the time you must show whoever you want the refund from a receipt.

4 0
4 years ago
Read 2 more answers
The total cost of a DUI could be as high as----- dollars?<br> a100<br> b500<br> c1000<br> d8000
Svet_ta [14]
the answer is d because depending on your state's laws they can also and endangerment of self and others 
7 0
4 years ago
Read 2 more answers
What is a computer memory <br>​
Alex_Xolod [135]

Answer:

In computing, memory is a device or system that is used to store information for immediate use in a computer or related computer hardware and digital electronic devices. The term memory is often synonymous with the term primary storage or main memory. An archaic synonym for memory is store.

5 0
3 years ago
Read 2 more answers
Which of the following helps create a positive community?
Lera25 [3.4K]

Answer: D.) all of the above

Explanation: By doing all three of these it makes almost everyone in the community is happier and more positive which is better than the bully's & people who don't speak up feel less entitled, it achieves the goal.

5 0
3 years ago
Other questions:
  • The default case is required in the switch selection statement.
    12·1 answer
  • Create a SavingsAccount class. Use a static data member annualInterestRate to store the annual interest rate for each of the sav
    10·1 answer
  • Write a declaration for a class named City, which has the members cityName, a string, and position, a Location structure (declar
    10·1 answer
  • I am on windows 10 OS. I have been trying to figure this out for ages! I want to get my task bar (on the bottom of the screen) t
    14·2 answers
  • How do operating system work?
    5·1 answer
  • What is the device that is non-volatile sometime called external memory?<br>​
    15·1 answer
  • what does it mean if you get the brainlyest ?and why does everyone want it so bad? and how do i give it to someone?
    6·1 answer
  • Select the correct answer.
    10·1 answer
  • Jeni is using the Label Wizard to solve a problem. What problem was she most likely experiencing?
    13·1 answer
  • Project: Design and Development Research Project
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!