// Properties of spheres of radii 1, 3, and 7 // with densities 7.87, 8.96, 11.36 respectively // using function arguments #include #include using namespace std; const double pi = 3.1416; void Sphere(double r, double rho) // r=radius, rho=density { double area, volume, mass; area = 4. * pi * r * r; volume = 4./3. * pi * r * r * r; mass = rho * volume; cout << r << ' ' << area << ' ' << volume << ' ' << mass << endl; } int main() { Sphere(1., 7.87); Sphere(3., 8.96); Sphere(7., 11.36); }