-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathOverloading_of_functions.cpp
More file actions
35 lines (31 loc) · 1.13 KB
/
Copy pathOverloading_of_functions.cpp
File metadata and controls
35 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
using namespace std;
float volume(float); // function decleration
float volume(int, float); // function decleration
float volume(float, float, float); // function decleration
int main()
{
int l, b, h, s; // vaariable decleration of integer type
system("cls");
int r;
cout << "Enter the values of l , b, h ,s";
cin >> l >> b >> h >> s >> r; // Entering the value of l b h s r b y user..
cout << "Volume of cyliender=" << volume(r, h) << endl; // volume(r,h) is called here..
cout << "Volume of cube=" << volume(s) << endl; // volume(s) is called here..
cout << "Volume of rectangular box =" << volume(l, b, h) << endl; // volume(l,b,h) is called here.
}
float volume(int r, float h)
{
float v = 3.145 * r * r * h; // float type variable v is defined here
return (v);
}
float volume(float s)
{
float v = s * s * s; // float type variable v is defined here
return (s);
}
float volume(float l, float b, float h)
{
float v = l * b * h; // float type variable v is defined here
return (v);
}