Write a c++ program to find area of rectangle using function?

2 Answers

Liam Rudge Profile
Liam Rudge answered
Create a float function to return the value of the area from two specified numbers; Note: "You can use integers but it's advised to use floats to return the decimal values for exact accuracy." float cArea(float width, float height) { float _cArea = width * height; return _cArea; } You should manipulate the bolded code to your needs. To use this function in your code just call cArea with two plugged in values; like this for example, cout << "The area of a rectange with a width of 5cm and a height of 7cm is " << cArea(5, 7);

Answer Question

Anonymous