# 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.<br>Write three versions: <br>one for cube's volume that takes one float side of the cube,<br>one for cylinder's volume takes float radius and float height of the cylinder, <br>and one rectangular box's volume that takes float length ,float breadth and float height of the box.

Expert's answer

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

}

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

}

## Comments

## Leave a comment