Develop a C++ program to calculate the area, perimeter and diagonal of a rectangle. The program should also offer the option to display the rectangle. The main flow of the program is given as follows: The user should input the length and width of a rectangle. The user can decide to display the drawing of the rectangle or not. If user indicate yes, execute user's decision. Display the calculated area, perimeter and diagonal of the rectangle. The program should repeatedly ask if the user wants to process another rectan- gle. Your program should include two functions with the following function prototypes: void drawRec(int length, int width); A function that display a full rectangle with '+'. void calcRec (int a, int b, int *area, int *perim, float *diag); A function that returns the area, perimeter and diagonal through pointer parame- ter. Sample output:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
Develop a C++ program to calculate the area, perimeter and diagonal of a rectangle.
The program should also offer the option to display the rectangle. The main flow of
the program is given as follows:
The user should input the length and width of a rectangle.
The user can decide to display the drawing of the rectangle or not. If user indicate
yes, execute user's decision.
Display the calculated area, perimeter and diagonal of the rectangle.
The program should repeatedly ask if the user wants to process another rectan-
gle.
Your program should include two functions with the following function prototypes:
void drawRec(int length, int width);
A function that display a full rectangle with '+'.
void calcRec (int a, int b, int *area, int *perim, float *diag);
A function that returns the area, perimeter and diagonal through pointer parame-
ter.
Sample output:
Transcribed Image Text:Develop a C++ program to calculate the area, perimeter and diagonal of a rectangle. The program should also offer the option to display the rectangle. The main flow of the program is given as follows: The user should input the length and width of a rectangle. The user can decide to display the drawing of the rectangle or not. If user indicate yes, execute user's decision. Display the calculated area, perimeter and diagonal of the rectangle. The program should repeatedly ask if the user wants to process another rectan- gle. Your program should include two functions with the following function prototypes: void drawRec(int length, int width); A function that display a full rectangle with '+'. void calcRec (int a, int b, int *area, int *perim, float *diag); A function that returns the area, perimeter and diagonal through pointer parame- ter. Sample output:
A function that returns the area, perimeter and diagonal through pointer parame-
ter.
Sample output:
Enter the 1ength and width of a rectangle: 4 8
Draw rectangle? 1 for yes, 2 for no: 1
++++
+++
The area is 32.
The perimeter is 24.
The diagonal is 8.94427.
Would you like to calculate another rectangle?
Enter y for Yes, n for NO. -> y
Enter the length and width of a rectangle: 7 2
Draw rectangle? 1 for yes, 2 for no : 2
The area is 14.
The perimeter is 18.
The diagonal is 7.28011.
Would you like to calculate another rectangle?
Enter y for Yes, n for NO. ->n
Please press any key to exit...
Transcribed Image Text:A function that returns the area, perimeter and diagonal through pointer parame- ter. Sample output: Enter the 1ength and width of a rectangle: 4 8 Draw rectangle? 1 for yes, 2 for no: 1 ++++ +++ The area is 32. The perimeter is 24. The diagonal is 8.94427. Would you like to calculate another rectangle? Enter y for Yes, n for NO. -> y Enter the length and width of a rectangle: 7 2 Draw rectangle? 1 for yes, 2 for no : 2 The area is 14. The perimeter is 18. The diagonal is 7.28011. Would you like to calculate another rectangle? Enter y for Yes, n for NO. ->n Please press any key to exit...
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education