Sign in with
Sign up | Sign in
Your question

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

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

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. }

February 5, 2013 5:08:06 AM

Related resources
February 5, 2013 5:09:54 AM

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

Best answer selected by sugu.
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:

C++ function overloading examples:

Good luck.