Write a an application that prints the following patterns separately one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed by a single statement of the form cout << '*' ; (this causes the asterisks to print side by side). Hint: The last two patterns require that each line begin with an appropriate number of blanks.
(A) (B) (C) (D)
* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
Break it down. Count the number of asterisk's (*) and you will find how many spaces you need to use (* - 1) on B and D.
Experiment with the for loop. First, make it print out X number of * (x = 1). Increment X + 1 (x++) in your for loop. Keep going until you have the size pattern you need.