Write single C++ statements or portions of statements that do the following:

a) Input integer variable x with cin and >>.
b) Input integer variable y with cin and >>.
c) Set integer variable i to 1.
d) Set integer variable power to 1.
e) Multiply variable power by x and assign the result to power.
f) Preincrement variable i by 1.
g) Determine whether i is less than or equal to y.
h) Output integer variable power with cout and <<.


a) cin >> x;
b) cin >> y;
c) i = 1;
d) power = 1;
e) power *= x;
or
power = power * x;
f) ++i;
g) if ( i <= y )
h) cout << power << endl;

Computer Science & Information Technology

You might also like to view...

Two related arguments that we would want to pass to a jump() method (e.g., to make a fish jump out of the water) are height and resistance.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Though an invitee can propose a new meeting time, only the ____ can change or delete the meeting.

A. originator B. attendee C. navigator D. scheduler

Computer Science & Information Technology

Which of the following statements about navigating through snippets is false?

a. The up and down arrow keys navigate backwards and forwards through the current interactive session’s snippets. b. Pressing Shift+Enter re-executes the snippet that’s displayed. c. In IPython, every recalled snippet that you execute gets a new ID. d. All of the above statements are true.

Computer Science & Information Technology

Which of the following is not true about the slide master?

A) While you are working on the slide master, all of the other PowerPoint tools are available. B) When you have completed your work with the slide master, it is very important that you close Slide Master view before you begin to populate your presentation with information. C) The slide master contains layouts for the template. D) The slide master is a special template presentation that details fonts, placement of footers, background colors, and other characteristics for the presentation.

Computer Science & Information Technology