Question: Using this starter code: #include //function prototypes void PrintLine(int length, char theChar); void PrintRectangle(int width, int height, char theChar); void PrintTriangle(int baseLength, char theChar); void
Using this starter code:
#include
//function prototypes void PrintLine(int length, char theChar); void PrintRectangle(int width, int height, char theChar); void PrintTriangle(int baseLength, char theChar); void PrintInvertedTriangle(int height, char theChar);
int main(void)
{
char choice; int a, b; char character;
//asking for user input printf("Which shape (L-line, T-triangle, R-rectangle, I-inverted triangle): "); scanf(" %c", &choice); printf("Which character: "); scanf(" %c", &character); switch (choice) { //if user input is for a triangle case 'T': case 't': printf("Enter an integer base length between 3 and 25: "); scanf("%d", &a); if (a >= 3 && a
//if user input is for a rectangle case 'R': case 'r': printf("Enter an integer width and height between 2 and 25: "); scanf("%d%d",&a, &b); if((a25 )){ printf("Width not in range."); break; } if((b25)){ printf("Height not in range."); break; } if(a >= 2&&a=2&&b
//if user input is a line case 'L': case 'l': printf("Enter an integer length between 1 and 25: "); scanf("%d", &a); if (a >= 1 && a
//if user input is an inverted triangle case 'i': case 'I': printf("Enter an integer base length between 2 and 25: "); scanf("%d", &a); if (a >= 2 && a
//if user input isn't a line, rectagnle, triangle or inverted triangle default: printf("Unknown shape. "); break; } }
//line function void PrintLine(int length, char theChar) { int i; for (i = 0; i
//triangle function void PrintTriangle(int baseLength, char theChar) { int i, j; for (i = 1; i
//rectangle function void PrintRectangle(int width, int height, char theChar) { int i, j; for (i = 0; i
//inverted triangle function void PrintInvertedTriangle(int height, char theChar) { int i; for (i = height; i > 0; i--) { PrintLine(i, theChar); } }
Answer this prompt in C programming: 
Using your solution to CE_6.2 as your starter code: Create a new void function to print a pyramid called PrintPyramid. Modify your prompt for the new shape: op or P for a pyramid then prompt for a width (range 2 - 25) . if the width is valid, call the Print Pyramid function You must implement your PrintPyramid function using ONLY the user defined functions you have written so far. There should be NO LOOPS in the function implementation! NOTES: You must verify the input range. All previous functions must work properly, and all previous (CE_6.1 and CE_6.2) test cases must still pass. Sample output (sample input shown with underline): Which shape (L-line, T-triangle, R-rectangle, I-inverted triangle, P-pyramid): P Which character: $ Enter an integer width between 2 and 25: 26 Width not valid. Which shape (L-line, T-triangle, R-rectangle, I-inverted triangle, P-pyramid): P Which character: A Enter an integer width between 2 and 25: 6 AAA AAAA AAAAA A A A A A A AAAAA AAAA A
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
