-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction oveoading.cpp
More file actions
67 lines (54 loc) · 990 Bytes
/
Function oveoading.cpp
File metadata and controls
67 lines (54 loc) · 990 Bytes
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
#include<iostream.h>
#include<conio.h>
class fundemo
{
public:
void swap(int &, int &);
void swap(char &, char &);
void swap(float &, float &);
};
void fundemo::swap(int &a, int &b)
{
int t;
t=a;
a=b;
b=t;
}
void fundemo::swap(char &p, char &q)
{
char t;
t=p;
p=q;
q=t;
}
void fundemo::swap(float &m, float &n)
{
float t;
t=m;
m=n;
n=t;
}
void main()
{
clrscr();
fundemo f;
int a,b;
char p,q;
float m,n;
cout<<"\n\n Enter two integer a and b\t";
cin>>a>>b;
cout<<"\n\n Before swaping a and b is:\t"<<a<<"\t"<<b;
f.swap(a,b);
cout<<"\n\n After swaping a and b is:\t"<<a<<"\t"<<b;
cout<<"\n\n Enter two character p and q\t";
cin>>p>>q;
cout<<"\n\n Before swaping p and q is:\t"<<p<<"\t"<<q;
f.swap(p,q);
cout<<"\n\n After swaping p and q is:\t"<<p<<"\t"<<q;
cout<<"\n\n Enter two float m and n\t";
cin>>m>>n;
cout<<"\n\n Before swaping m and n is:\t"<<m<<"\t"<<n;
f.swap(m,n);
cout<<"\n\n After swaping m and n is:\t"<<m<<"\t"<<n;
getch();
}