#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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section13.1: Single Structures
Problem 4E
icon
Related questions
Question

#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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage