Swap numbers using temporary variable

Description:

Swap the two given numbers using temporary variable Test Case 1 Input (stdin) 10 20 Expected Output Before a=10 b=20 After a=20 b=10 Test Case 2 Input (stdin) 6 3 Expected Output Before a=6 b=3 After a=3 b=6

Program :

#include <iostream>

using namespace std;

int main()

{

    int a,b,d,t=0;

    cin>>a;

   cin>>b;

  cout<<"Before\n";

  cout<<"a="<<a;

  cout<<" b="<<b;

  cout<<"\nAfter\n";

  t=a;

  d=b;

  cout<<"a="<<d;

  cout<<" b="<<t;

 

return 0;

}