answersLogoWhite

0


Best Answer

Assuming you know the radius of the sphere, use the following function to calculate the surface area:

double area_of_sphere(const double& radius) {

return(pi * radius * radius * 4); }

Note: pi (π) is a global constant defined as follows:

const double pi = atan(1)*4;

Calculating pi this way ensures the highest possible precision on the runtime hardware.

The area calculation is based upon the following formula:

4πr2

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a C plus plus program to find surface area of a sphere?
Write your answer...
Submit
Still have questions?
magnify glass
imp