C++ Program to swap two numbers using function.

How to write a C++ Program to swap two numbers using function in C++ Programming ?

c program to swap two numbers using function call by value write a program to swap two numbers using function in c++ program to swap two numbers using functions in java program to swap two numbers using pointers and functions c program to swap two numbers using pointers without using third variable program to swap two numbers using call by reference in c++ program to swap two numbers using bitwise operators program to swap two numbers without using temporary variable
C++ Program to swap two numbers using function.


Solution:
//Program to swap two numbers using function.
#include<iostream.h>
#include<conio.h>
void swap(int&,int&);
void main()
{
clrscr();
int a,b,c;
cout<<"Enter one numbers: ";
cin>>a;
cout<<"Enter second number: ";
cin>>b;
swap(a,b);
cout<<a<<" "<<b;
getch();
}
void swap(int &a,int &b)
{
int c;
c=a;
a=b;
b=c;
}

This C++ Program to swap two numbers using function.


Learn More :