#include #include using namespace std; int main() { float sp_Radius, sp_sa, sp_Volume; cout << "\nPlease Enter the radius of a Sphere = "; cin >> sp_Radius; sp_sa = 4 * M_PI * sp_Radius * sp_Radius; sp_Volume = (4.0/3) * M_PI * sp_Radius * sp_Radius * sp_Radius; cout << "\nThe Surface Area of a Sphere = " << sp_sa; cout << "\nThe Volume of a Sphere = " << sp_Volume; return 0; } C++ use this code and separate the program into three files. The main program containing the main function should be named main.cpp. The function definition file containing a function for the volume calculation and a function for the surface area calculation should be named SphereCalc.cpp. The function declaration file containing function declarations for the functions should be named SphereCalc.h. Make sure you include a Header Guard. Read the Radius from the Keyboard. If a negative number is provided, set the calculated value to zero.
#include<iostream>
#include <cmath>
using namespace std;
int main() {
float sp_Radius, sp_sa, sp_Volume;
cout << "\nPlease Enter the radius of a Sphere = ";
cin >> sp_Radius; sp_sa = 4 * M_PI * sp_Radius * sp_Radius; sp_Volume = (4.0/3) * M_PI * sp_Radius * sp_Radius * sp_Radius;
cout << "\nThe Surface Area of a Sphere = " << sp_sa; cout << "\nThe Volume of a Sphere = " << sp_Volume; return 0;
}
C++ use this code and separate the program into three files. The main program containing the main function should be named main.cpp. The function definition file containing a function for the volume calculation and a function for the surface area calculation should be named SphereCalc.cpp. The function declaration file containing function declarations for the functions should be named SphereCalc.h.
Make sure you include a Header Guard.
Read the Radius from the Keyboard. If a negative number is provided, set the calculated value to zero.

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images









