- Create A Program That Asks The User For The Width And Height Of A Rectangle The Program Must Then Output An Ascii Art D 1 (156.13 KiB) Viewed 28 times
Create a program that asks the user for the width and height of a rectangle. The program must then output an ASCII art d
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Create a program that asks the user for the width and height of a rectangle. The program must then output an ASCII art d
Create a program that asks the user for the width and height of a rectangle. The program must then output an ASCII art diagram (always the same 7-by-3 shape shown below) and then compute the area and perimeter, displaying the result to three decimal places. Remember, for a rectangle: area = width x height perimeter = width + width + height + height Declare, define, and from main call, the following modular functions (each must be free of side- effects such as unnecessary printing or scanning) - use the following prototypes: void print_diagram (float width, float height); float compute_area (float width, float height); float compute_perimeter (float width, float height); When run, the program's console output must be in the following style: 1 Rectangle width? 27.05 2 Rectangle height? 20.30 3 4 27.05 5+-+ 6 | 20.30 7+---- + 8 10 The area is: 549.115 11 The perimeter is: 94.700