Question: HW#4 Nested For Loops Command window graphics In HW#4, the objective is to draw a diamond pattern of asterisk symbols in the output window. The
HW#4 Nested "For" Loops Command window graphics In HW#4, the objective is to draw a diamond pattern of asterisk symbols in the output window. The diamond pattern is obtained by varying the number of asterisks on each line and bracketing them by the appropriate number of spaces The lateral offset can be obtained by inserting the proper number of spaces at the beginning of each line The diamond patterns must have an equal height and width. Height and width must be an odd unsigned integer. There must be exactly one asterisk in both the top and bottom line You are only allowed to use three commands to draw the pattern: cout output single space. cout output asterisk symbol cout "An'': output newline. The diamond algorithm can be broken into two pyramid algorithms with the lower pyramid being inverted under the upper pyramid. A single line algorithm consists of three sequential "for" loops which draw the appropriate numbers of offset spaces, pattern spaces, and asterisks. Student must print the program header, prompt for inputs of diamond width and lateral offset, print the pattern, and print an author line with your name Students can earn a bonus point for trapping an even input for width and converting it into the next larger odd number. tlpt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
