Priyanshu_Gupta

Method Overloading

Sep 8th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<iostream>
  3. #include<conio.h>
  4. using namespace std;
  5. void volume(int);
  6. void volume (int ,int,int);
  7. int main()
  8. {
  9.     int radius,length,breadth,height;
  10.     cout<<"Enter The Radius Of Sphere :";
  11.     cin>>radius;
  12.     volume(radius);
  13.     cout<<"\nEnter The Length , Breadth And Height Of Cuboid :"<<endl;
  14.     cin>>length>>breadth>>height;
  15.     volume(length,breadth,height);
  16.     getch();
  17.     return 0;
  18. }
  19. void volume(int r)
  20. {
  21.     // float volume=4/3*3.14*(r*r*r);
  22.     float volume=(4*3.14*(r*r*r))/3;
  23.     cout<<"Volume Of Sphere Is :"<<volume;
  24. }
  25. void volume(int l,int b,int h)
  26. {
  27.     int volume=l*b*h;
  28.     cout<<"Volume OF Cuboid Is :"<<volume;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment