Solved

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

Hello,
how to calculate area and volume of shapes using function overloadig?
5 answers Last reply Best Answer
More about program shapes calculate area volume function overloading
  1. Best answer
    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:
    
    int cube_volume(int width, int height, int length){
        return width*height*length;
    }
    
  2. hai .........
    i need area n volume for diff shapes.....
  3. Best answer selected by sugu.
  4. 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.htm

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

    Good luck.
Ask a new question

Read More

Windows 7