Swapping Program in C++ (C Plus Plus)

Swapping Program in C++ (C Plus Plus)

In this latest tutorial, we will cover the following topics;

  1. Swapping Program in C++ (C Plus Plus)
#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:

Before and after swapping Program in C++ (C Plus Plus)

Prof. Fazal Rehman Shamil
Researcher, Publisher of International Journal Of Software Technology & Science ISSN: 2616-5325
Instructor, SEO Expert, Web Programmer and poet.
Feel free to contact.