Question: Here are the steps that can help you with this C++ problem: And here is the codes so far that I have (I am stuck

 Here are the steps that can help you with this C++

Here are the steps that can help you with this C++ problem:

problem: And here is the codes so far that I have (I

And here is the codes so far that I have (I am stuck on the BOLDENED steps that create that pyramid shape, so basically I have no clue how to set up the loops)

#include using namespace std;

int main() { // Variable declaration int n; // This variable read in by user // Prompt users for correct n value cout > n; while (n > n; } while (n % 2 == 0) { cout > n; }

// Set up for loops to establish pyramid shape // End program return 0; }

Here are the things you should remember for this problem:

1. This is C++, so please use C++ programming knowledge.

2. Please do not use complicated C++ knowledge, such as array, class, vector, function, string, etc to code this program. I was told that this problem can be coded using only basic for loops and some other understanding of how loops work. I have only covered loops so far, not the aforementioned knowledge.

3. The sample output for the problem is already given above for you to test your code on. So please test your codes to make sure your codes are correct before you post your answer.

4. You should use my work so far to begin with just the loop setup step to save you more time. (Of course, feel free to correct my codes if you see something incorrect).

5. Feel free to add comments to important steps of the loops (e.g explanation of how you set up the loop conditions, as well as your thought process, etc) because I really need to thoroughly understand this problem.

I will give you feedbacks whether your codes are clear and easy to understand. Thanks for the long read!

Write a program pyramid.cpp that reads a positive odd whole number n and prints a pyramid where the last row contains all numbers from n down to 1 (i.e., descending order), the second to last row displays all numbers from n - 1 down to 2, the third to last row displays all numbers from n 2 down to 3, etc. The first row will contain only a single value, i.e. the middle value in the range, i.e. n down to 1. Each successive row contains two more values than the previous row For example, if n is 9, then the program will output 654 76543 8765432 987654321 If n is 13, then the program will output 876 98765 0987654 109876543 21098765432 3210987654321 The i'th row contains 2i 1 values. Each column displays the same number. If a row has more than 10 digits, the digit after 0 should start again from 9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!