Swapping Program in C++ (C Plus Plus)
Swapping Program in C++ (C Plus Plus)
In this latest tutorial, we will cover the Swapping Program in C++ (C Plus Plus).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> using namespace std; int main() { int x,y,temp; cout<<"Enter VAlue of X is "; cin>>x; cout<<"Enter Value of Y is "; cin>>y; cout<<"Value of X and Y is "<< x<<"\tand\t"<<y<<endl; temp=x; x=y; y=temp; cout<<"Value of x and y after swapping "<<x<<"\tand\t"<<y<<endl; } |
Output: