swapping of two numbers c++ using third variable

                  

//use header files syntax according to the compiler

// in this prog. input two values in a and b and take a third var. temp. now assign a to temp then assign b to a and finally assign temp to b. so values of a and b are interchanged using the third variable.

#include <iostream.h>

#include<conio.h>

 void main()
{
  int temp,a,b;
  cout<<"enter 2  numbers:";
  cin>>a>>b;
  cout<<"a:"<<a<<" b:"<<b;
  temp=a;
  a=b;
  b=temp;
  cout<<"after swapping the values ";
  cout<<"a:"<<a<<" b:"<<b;
  getch();
}

//example: before swap a=12 and b=34

//                 after swap  a=34 and b=12