Sign in with
Sign up | Sign in
Your question
Solved

C program for shapes to calculate area and volume using function overloading

Tags:
Last response: in Windows 7
Share
February 5, 2013 4:59:12 AM

Hello,
how to calculate area and volume of shapes using function overloadig?

Best solution

February 5, 2013 5:05:05 AM

Missing lots of details here.

What sort of shape?
"Overloading" is a function of C++ not C

for example if you want to get the volume of a cube:
  1. int cube_volume(int width, int height, int length){
  2. return width*height*length;
  3. }



Share
February 5, 2013 5:08:06 AM

thanks
m
0
l
Related resources
Can't find your answer ? Ask !
February 5, 2013 5:09:54 AM

hai .........
i need area n volume for diff shapes.....
m
0
l
February 5, 2013 5:12:31 AM

Best answer selected by sugu.
m
0
l
February 5, 2013 6:42:23 AM

It is really quite easy. Just look up the area and volume formula of the shapes on google and perform the math is C or C++.

Volume of pyramid is (Base * height) / 3
Area of triangle is (base * 0.5) * height

Area of rectangle is width*height

Other shape formulas can be found easily and be implemented like above.

C operators: http://www.tutorialspoint.com/ansi_c/c_operator_types.h...

C++ function overloading examples: http://www.learncpp.com/cpp-tutorial/76-function-overlo...

Good luck.
m
0
l
!