Saturday 23 March 2019

CPP-EX41

Write a C++ program to find area and volume of a cylinder using  inline function.

#include<iostream.h>
#include<conio.h>


 inline float vol(float r,float h)
   {
    return(3.14*r*r*h);
   }


 inline float area(float r,float h)
   {
    return(2*3.14*r*h);
   }


 int main()
   {
    float radius,height;
    clrscr();
    cout<<"\n\nEnter the radius of the cylinder:";
    cin>>radius;
    cout<<"\nEnter the height of the cylinder:";
    cin>>height;
    cout<<"\nVolume of Cylinder:"<<vol(radius,height);
    cout<<"\nArea of Cylinder:"<<area(radius,height);
    getch();
    return 0;
   }