-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction_P1.cpp
More file actions
47 lines (47 loc) · 1.02 KB
/
function_P1.cpp
File metadata and controls
47 lines (47 loc) · 1.02 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
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream.h>
#include<conio.h>
class shape
{
public:
inline void area(int i)
{
cout<<"\n\t Area of square : "<<(i* i);
}
void area(double,double);
void area(int,int);
};
void shape :: area(double r,double pi=3.14)
{
cout<<"\n\t Area of circle : "<<(pi*r*r) ;
}
void shape :: area(int l, int b)
{
cout<<"\n\t Area of rectangle : "<<(l*b);
}
void main ( )
{
shape s;
int side,length,breadth;
double radius;
clrscr();
cout<<"\n\tFUNCTION OVERLOADING WITH DEFAULT ARGUMENTS AND INLINE FUNCTION";
cout<<"\n\t---------------------------------------------------------------";
cout<<"\n\nArea of Square";
cout<<"\n-----------------";
cout<<"\nEnter the side :";
cin>>side ;
s.area(side);
cout<<"\n\nArea of Circle";
cout<<"\n---------------";
cout<<"\nEnter the radius : ";
cin>>radius;
s.area(radius);
cout<<"\n\nArea of Rectangle";
cout<<"\n-------------------";
cout<<"\nEnter the length : ";
cin>>length ;
cout<<"\nEnter the breadth : " ;
cin>>breadth ;
s.area(length,breadth);
getch( );
}