Sunday, 27 November 2011

C++ Program For Swap 2 Variables Using Function [Call By Value]


#include<iostream.h>
#include<conio.h>
void swap(int a,int b)
 {
  int temp;
  temp=a;
  a=b;
  b=temp;
  cout<<"\n"<<a<<" "<<b;
 }
void main()
 {
   void swap(int a,int b)
   int a,b;
   cout<<"enter two numbers";
   cin>>a>>b;
   swap(a,b)
   cout<<a<<" "<<b;
   getch();
 }

No comments:

Post a Comment