#include<iostream>
#define PI 3.14
using namespace std;
int main(){
double r;
cout<<"Enter radius of sphere";
cin>>r;
double sa,vol;
sa=4*PI*r*r;
vol=(1.33)*PI*r*r*r;
cout<<"Surface area of sphere is "<<sa<<endl;
cout<<"Volume of sphere is "<<vol<<endl;
}

if you like the answer please provide a thumbs up.
Need in C++ Assignment #1: Write a program to ask the user for a sphere radius...
Please help me to write a program in C++ with comments and to
keep it simple as possible.
Thank you!
Here is my program I have done before and that need
to be change:
#include <iostream>
#include <iomanip>
using namespace std;
// function prototype – returning one value
double cylvol(double, double); // Note: two data types inside
brackets
double surfarea(double, double); // Note: two data types inside
brackets
int main()
{
double r, l, V, S;
cout << setprecision(2) <<...
Write a C++ program to compute the total volume of N cones, where N is a number entered by the user. Repeat the request for N until the user enters a positive number. For each cone, ask for the radius and height, compute the volume, and add that volume to the total. Each time you ask the user to enter either the height or the radius, if the user does not enter a positive number, display an error message and...
Can someone help me with this coding question. I cannot get this to run properly. Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of π. The program should use PI and the functions listed in Table 6-1 to accomplish the following: Output the value of √π . Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs...
Problem: Write a short C++ program that gets the side of a cube and the radius of a sphere from the keyboard and writes to a file the surfaces of these shapes. ------------------------------------------------------------------------------------------------------------------------ Your task: implement in C++ the algorithm solution shown below. ------------------------------------------------------------------------------------------------------------------------ Part A (79 points) Algorithm solution (in pseudocode): To accomplish this task, your program will have to take the following steps: 1. Declare a variable named outFile that represents an output stream. 2. Declare a...
Problem 3 (5 points) Write a program that prompts the user for the radius of a sphere. Your program should then compute values for the area, and volume of the sphere. Your program should then output the results for the sphere area, and volume. Enter the radius of the sphere as a real number? 10.5 The area of a sphere with radius 10.5 is 1385.44 The volume of a sphere with radius 10.5 is 4849.05
Geometric calclator use python to do this program. Write a program that displays the following menu: 1. Calculate the area of circle 2. calculate the area of rectangle 3. calculate the area of triangle 4. Quit Enter your choice (1-4). if the user enters 1, your program should ask for the radius of the circle and then display its area. Use the formula to calculate the circle's area: Area = pi*r^2 Use 3.14149 for Pi and the radius of the...
Write a program to calculate the volume and surface area of a sphere from it radius given as input. Here are some formulas that might be useful: V = 4/3πr3 A = 4 πr2
I'm trying to write a program that can ask a user about what type of solid they have and to be able to enter values like radius and length of the shape so the program can calculate the volume of a shape and print the result. I also want to give them a repeating option to input another shape if they want to. I'm trying to use at least 7 functions that can display an output, the volumes of a...
Write a Python program that computes the volume of a sphere with a radius of 5. The formula for a sphere is 4⁄3πr3. Write a function sphere_volume that returns the volume of a sphere when given radius r as a parameter. Then write a main program that calls sphere_volume by passing an argument after getting it as an input from the user.
using Java The formula to compute the volume of a sphere is: volume = ( 4 3 ) π r 3 where r is the radius of the sphere and π is 3.14159. Assume a variable radius has already been declared (type double) and initialized with the value of the radius of a sphere. Write java statements to do the following: Declare a constant PI and initialize it to 3.14159 Declare a variable volume of type double Calculate the volume...