Answer to Question #128361 in C++ for zeeshan

Question #128361
Write a function called circarea() that finds the area of a circle. It should take an argument of type float and return an argument of the same type. Write a main() function that gets a radius value from the user, calls circarea(), and displays the result.
1
Expert's answer
2020-08-05T16:44:58-0400
#include <iostream>
#include <cmath>
#include <iomanip>


float circarea(float);


int main() {
	float radius;
	std::cout << "Input circle radius: ";
	std::cin >> radius;
	std::cout << std::setprecision(10);
	std::cout << "Circle area: " << circarea(radius) << std::endl;
}


float circarea(float radius)
{
	return M_PI * radius * radius;
}

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