Answer to Question #2702 in Action Script | Flash | Flex | ColdFusion for pawan deep

Question #2702
Write overloaded prototypes of volumes(), a function that returns volumes of different structures.
Write three versions:
one for cube's volume that takes one float side of the cube,
one for cylinder's volume takes float radius and float height of the cylinder,
and one rectangular box's volume that takes float length ,float breadth and float height of the box.
1
Expert's answer
2011-05-23T10:04:49-0400
#include <iostream>
#include <math.h>
using namespace std;

// The volume of the cube with the given side
double volume(const float side);

// The volume of the cylinder with the fiven radius and height
double volume(const float radius, const float height);

// The volume of the rectangular box's volume
double volume(const float length, const float breadth, const float height);

int main()
{
return 0;
}

// The volume of the cube with the given side
double volume(const float side)
{
return pow(side, 3);
}

// The volume of the cylinder with the fiven radius and height
double volume(const float radius, const float height)
{
return 3,1415926535898 * pow(radius, 2) * height;
}

// The volume of the rectangular box's volume
double volume(const float length, const float breadth, const float height)
{
return length * breadth * height;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS