Answer to Question #328733 in C++ for Florence

Question #328733

Write a program to print the area of a rectangle by creating a function 'Area' taking the values of its length and breadth as parameters of its constructor and having a function named 'returnArea' which returns the area of the rectangle. Length and breadth of the rectangle are entered through keyboard. And return the area of rectangle.

1
Expert's answer
2022-04-14T08:04:39-0400


#include<iostream>




using namespace std;




float Area(float length,float breadth)
{
	return length*breadth;
}


float returnArea(float length,float breadth){
	return Area(length,breadth);
}


int main(){
	float length;
	float breadth;
	cout<<"Enter length: ";
	cin>>length;
	cout<<"Enter breadth: ";
	cin>>breadth;
	cout<<"Area of the rectangle: "<<returnArea(length,breadth)<<"\n";


	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS