A variable like userNum 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 userNum * userNum. (2 pts)
Get a second user input into userNum2, and output the sum and product. (1 pt)

Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.

Enter integer:
4
You entered: 4
4 squared is 16
And 4 cubed is 64!!
Enter another integer:
5
4 + 5 is 9
4 * 5 is 20

Respuesta :

The program is an illustration of a sequential structure

What are sequential control structures?

Sequential control structures are programs that do not require loops and conditional statements

The actual program

The program in C++ where comments are used to explain each line, is as follows:

#include <iostream>

using namespace std;

int main(){

   //This declares the variables

   int userNum1, userNum2;

   //This prompts the user for input

   cout<<"Enter integer: \n";

   //This gets the input from the user

   cin>>userNum1;

   //This prints the number entered by the user

   cout<<"You entered: "<<userNum1<<'\n';

   //This prints the square of the number

   cout<<"And "<<userNum1<<" squared is "<<userNum1 * userNum1<<'\n';

   //This prints the cube of the number

   cout<<userNum1<<" cubed is "<<userNum1 * userNum1 * userNum1<<"!!\n";

   //This prompts the user for another input

   cout<<"Enter another integer:\n";

   //This gets the input from the user

   cin>>userNum2;

   //This prints the sum of both numbers

   cout<<userNum1<<" + "<<userNum2<<" is "<<userNum1 + userNum2<<'\n';

   //This prints the product of both numbers

   cout<<userNum1<<" * "<<userNum2<<" is "<<userNum1 * userNum2;

   return 0;

}

Read more about similar programs at:

https://brainly.com/question/24833629

ACCESS MORE