-
Notifications
You must be signed in to change notification settings - Fork 0
/
C++ Function overloading.cpp
67 lines (49 loc) · 1001 Bytes
/
C++ Function overloading.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//{ Driver Code Starts
//Initial Template for C++
#include <iostream>
using namespace std;
// } Driver Code Ends
//User function Template for C++
void volume(int s)
{
cout<<s*s*s<<endl;
}
void volume(int r, int h)
{
cout<<3.14159*r*r*h<<endl;
}
void volume(int l, int b, int h)
{
cout<<l*b*h<<endl;
}
//{ Driver Code Starts.
int main()
{
int t;
cin>>t;
while(t--)
{
int q;
cin>>q;
switch (q)
{
case 1:
int edge;
cin>>edge;
volume(edge);
break;
case 2:
int radius, heigh;
cin>>radius>>heigh;
volume(radius, heigh);
break;
case 3:
int length, width, height;
cin>>length>>width>>height;
volume(length, width, height);
break;
}
}
return 0;
}
// } Driver Code Ends