Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

graded out of30 points if not submitted during lab time Write a program, LablPartC.cpp, that stores 3 integers: side (of a square), length and width

image text in transcribed
graded out of30 points if not submitted during lab time Write a program, LablPartC.cpp, that stores 3 integers: side (of a square), length and width (of a rectangle). The values for these integers are entered by the user. Then modify it as follows: C.1: Functions with int as a return datatyge: Write a function called that accepts an integer representing the length of the side of a square as a parameter and calculates the area, then returns the area ofthat square. This function should not have any print statements. In your function print the area returned from this function without storing the returned value in a variable. C.2: Functions with bool as a return datatyge: Write a function called that accepts an integer representing the length of the side of a square as a parameter and calculates the area of that square. This function returns true if the calculated area is greater than 20. The function should not have any print statements. In your function print the statement '"I'he area is larger than 20\" if the value returned by the function is true, or \"The area is less than or equal 20\" otherwise. Do not use (== true) in your if statement, how would this work? Why? Can you rename this function in this program as , why (not)? Some Sample Outputs for the Programs are: Enter side, width and length: 5 10 20 Enter side, width and length: 4 S 8 Area of square with side 5 is 25 The area is larger than 20 Area of rectangle:2@0 Area of square with side 4 is 16 The area is less than 20 Area of rectanglez40

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions