#include<iostream>
#include<conio.h>
using namespace std;
void swap(char &,char &);
int main()
{
char ch1,ch2;
cout<<"Enter first character = ";cin>>ch1;
cout<<"Enter second character = ";cin>>ch2;
swap(ch1,ch2);
cout<<"After swapping character : ";
cout<<"\nNow first character = "<<ch1;
cout<<"\nNow second character = "<<ch2;
getch();
return(0);
}
void swap(char &a,char &b)
{
char temp;
temp=a;
a=b;
b=temp;
}
No comments:
Post a Comment