Question: // Draw.cpp : Defines the entry point for the console application. // #include stdafx.h /* Draws a stick figure */ #include /* Function prototypes */
// Draw.cpp : Defines the entry point for the console application. // #include "stdafx.h" /* Draws a stick figure */ #include/* Function prototypes */ void draw_circle(void); /* Draws a circle */ void draw_intersect(void); /* Draws intersecting lines */ void draw_base(void); /* Draws a base line */ void draw_triangle(void); /* Draws a triangle */ void draw_diamond(void); /* Draws a diamond */ int main(void) { /* Draw a circle. */ draw_circle(); /* Draw a triangle. */ draw_triangle(); /* Draw intersecting lines. */ draw_intersect(); /* Draw diamond. */ draw_diamond(); return (0); } /* * Draws a circle */ void draw_circle(void) { printf(" * "); printf(" * * "); printf(" * * "); } /* * Draws intersecting lines */ void draw_intersect(void) { printf(" / \\ "); /* Use 2 \'s to print 1 */ printf(" / \\ "); printf("/ \\ "); } /* * Draws a base line */ void draw_base(void) { printf("------- "); } /* * Draws a triangle */ void draw_triangle(void) { draw_intersect(); draw_base(); } /* * Draws a diamond */ void draw_diamond(void) { draw_intersect(); printf("\\ / "); printf(" \\ / "); printf(" \\ / "); }
Update the Draw program ABOVE by adding a while, for, or do-while loop statement to allow displaying the shapes multiple times according to the number entered by the user as shown in the following sample run of the program:
Please enter the number of circles to be displayed: 3
*
* *
* *
*
* *
* *
*
* *
* *
Please enter the number of triangles to be displayed: 2
/ \
/ \
/ \
------
/ \
/ \
/ \
------
Please enter the number of intersecting lines to be displayed: 4
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
Please enter the number of diamonds to be displayed: 4
/ \
/ \
/ \
\ /
\ /
\ /
/ \
/ \
/ \
\ /
\ /
\ /
/ \
/ \
/ \
\ /
\ /
\ /
/ \
/ \
/ \
\ /
\ /
\ /
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
