Write a C++ program that uses the statements in Exercise 3.7 to calculate x raised to the y power. The program should have a while repetition statement.

What will be an ideal response?


```
// Raise x to the y power.
#include
using namespace std;

int main()
{
int x; // base
int y; // exponent
int i; // counts from 1 to y
int power; // used to calculate x raised to power y

i = 1; // initialize i to begin counting from 1
power = 1; // initialize power

cout << "Enter base as an integer: "; // prompt for base
cin >> x; // input base

cout << "Enter exponent as an integer: "; // prompt for exponent
cin >> y; // input exponent
```

Computer Science & Information Technology

You might also like to view...

____________ are small devices that plug into a computer’s USB port and appear to the system as disk drives.

a. Virtual disk drives b. Universal Serial Bus (USB) drives c. Floppy disk drives d. External disk drives

Computer Science & Information Technology

You can use layers to make shapes appear to be stacked on top of one another. To move a shape from one layer to another, use options from the _____ group.

A. Arrange B. Reorder C. Layers D. Styles

Computer Science & Information Technology

If you are not sure what apps you own from the Windows Store, you can display a list of them on the ____ screen.

A. My library B. My apps C. What I own D. Purchased apps

Computer Science & Information Technology

What does a program use to access a private variable within a class?

A. private method B. public method C. public variable D. default constructor

Computer Science & Information Technology