Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write c++ Patterns, by using for loops (Task 1) Create a staircase with increasing numbers at each step up until numSteps: Example for numSteps ==

Write c++ Patterns, by using for loops

(Task 1) Create a staircase with increasing numbers at each step up until "numSteps":

Example for numSteps == 4

1

12

123

1234

(Task 2) Create a horizontal Pyramid to a maximum height of "heightPyramid". The height of a row is the horizontal distance from start till the end of the row in the Pyramid.

Example for heightPyramid == 3

\\

\\\\

\\\\\\

\\\\

\\

(Task 3: Extra Credit) Create a Diamond with a maximum height of "heightDiamond". The height here is the vertical distance from the first row to the last row of the diamond. For ease, only consider even values for the height.

Example for heightDiamond == 6

/\

/ \

/ \

\ /

\ /

\/

Hints:

  1. Can you figure out the number of spaces between the start of the row and the first slash? Can it be expressed as a function of the current row of the diamond and the height of the diamond?

  2. The number of spaces between the first and second slash can be expressed as twice of a certain variable. Can you figure out the exact formula for it?

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

Step: 3

blur-text-image

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

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

=+d. Write at least five sentences or phrases for body copy.

Answered: 1 week ago