0% found this document useful (0 votes)
17 views1 page

CPP Question

c++

Uploaded by

ekassingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

CPP Question

c++

Uploaded by

ekassingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

//1. Filename: \\JOOO.

CPP
// Program using function overloading to calculate the VOLUME OF of cube cylinder,cuboid
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include <math.h>
float volume(float a);
float volume(float l, float w);
float volume(float l,float h,float b);
void main()
{
char ch;
float rad, len, bred, side,length,breadth, hei,height, s;
float radius;
int choice1;
clrscr();
cout << "\n1. For volume of cube ";
cout << "\n2. For volume of cylinder ";
cout << "\n3. For volume of cuboid ";
cout << "\nEnter choice : ";
cin >> choice1;
if (choice1 == 1)
{
cout << "\nEnter the side ofcube : ";
cin >>s;
cout << "\nvolome of a cube : " << volume(side);
}
if (choice1 == 2)
{
cout << "\nEnter the radius : ";
cin >> rad;
cout << "\nEnter the height : ";
cin >> hei;
cout << "\nvolume of cylinder is : " << volume(radius, height);
}
if (choice1 == 3)
{
cout << "\nEnter the length : ";
cin >> len;
cout << "\nEnter the height : ";
cin >> hei;
cout << "\nEnter the breadth : ";
cin >> bred;
cout << "\nvolume of cuboid : " <<volume(length,height,breadth);
}
}
float volume(float a)
{
return(a*a*a);
}
float volume(float l, float w)
{
return(3.14*l*l*w);
}
float volume( float l,float h,float b)
{
return(l*h*b);
}

You might also like