Professional Documents
Culture Documents
Program No 8 (1) HG
Program No 8 (1) HG
x=y;
y=t;
}
void main()
{
clrscr();
char c1,c2;
cout<<"Enter two characters:"<<endl;
cin>>c1>>c2;
swap(c1,c2);
cout<<"On swapping c1,c2:"<<c1<<" "<<c2<<endl;
int a,b;
cout<<"Enter two integers(a,b)"<<endl;
cin>>a>>b;
swap(a,b);
cout<<"On swapping a,b:"<<a<<" "<<b<<endl;
float c,d;
cout<<"Enter two float(c,d):"<<endl;
cin>>c>>d;
swap(c,d);
cout<<"On swapping c,d:"<<c<<" "<<d<<endl;
getch();
}
---------------------------------------Output-----------------------------------
Enter two characters:
dD
On swapping c1,c2:D d
Enter two integers(a,b)
56 54
On swapping a,b:54 56
Enter two float(c,d):
5.43 7.88
On swapping c,d:7.88 5.43