1.

Write a program to declare two variables in class and swap it using class in C++.

Answer»

class SWAP { int a,b; PUBLIC: void getdata(); void swapv(); void display(); }; void swap::getdata() { COUT<<“Enter TWO numbers:”; cin>>a>>b; } void swap::swapv() { a=a+b; b=a-b; a=a-b; } void swap::display() { cout<<“a=”<



Discussion

No Comment Found