- #1
ineedhelpnow
- 651
- 0
Given sphereRadius and piVal, compute the volume of a sphere and assign to sphereVolume. Look up the equation online. Use (4.0 / 3.0) to perform floating-point division, instead of (4 / 3) which performs integer division.
Sample program:
#include <iostream>
using namespace std;
int main() {
const double piVal = 3.14159;
double sphereVolume = 0.0;
double sphereRadius = 0.0;
sphereRadius = 1.0;
<STUDENT CODE>
cout << "Sphere volume: " << sphereVolume << endl;
return 0;
ive tried EVERYTHING for this but i still can't figure out how to compute the volume. equation for the volume of a sphere is $\frac{4}{3} \pi r^2$. oh and instead of 4 and 3 i have to use 4.0 and 3.0.
Sample program:
#include <iostream>
using namespace std;
int main() {
const double piVal = 3.14159;
double sphereVolume = 0.0;
double sphereRadius = 0.0;
sphereRadius = 1.0;
<STUDENT CODE>
cout << "Sphere volume: " << sphereVolume << endl;
return 0;
ive tried EVERYTHING for this but i still can't figure out how to compute the volume. equation for the volume of a sphere is $\frac{4}{3} \pi r^2$. oh and instead of 4 and 3 i have to use 4.0 and 3.0.