#include<iostream.h>
#include<conio.h>
class swap
{
int a,b,c;public:
void input();
void calculate();
void display();
};
void swap::input()
{
cout<<"Enter the value of a=";
cin>>a;
cout<<"Enter the value of b=";
cin>>b;
}
void swap::calculate()
{
c=a;
a=b;
b=c;
}
void swap::display()
{
cout<<"a="<<a<<"b"<<b;
}
void main()
{
clrscr();
swap A;
A.input();
A.calculate();
A.display();
getch();
}
No comments: