Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The C++ program should ask the user the initial number of asterisks it will display in the first row after the input. The C++ program

The C++ program should ask the user the initial number of asterisks it will display in the first row after the input. The C++ program then should display a decreasing number of asterisks in the succeeding row until it reaches a single asterisk. The C++ program should also display the total number of asterisks printed on the screen.

Fill in the blanks in the incomplete C++ program:

#include

using namespace std;

int main() {

int x, no, y, total = 0;

cout << "How many stars? ";

cin >> no;

for (x = no; _____________; x--) {

total = _____________

for (_____________; y > 0; y--)

cout << "*";

cout << " ";

}

cout << "Wow " << total << " stars in all!!!";

return 0;

}

The output should be:

How many stars? 6

******

*****

****

***

**

*

Wow 21 stars in all!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

How can you calculate your net worth now and at retirement?

Answered: 1 week ago