#include<iostream>
using namespace std;
void swap(int &num1, int &num2);
void main()
{
int Var1, Var2;
cout<<"Enter two numbers "<<endl;
cin>>Var1;
cin>>Var2;
cout<<"you entered number 1 that is: "<<Var1<<endl;
cout<<"you entered number 2 that is: "<<Var2<<endl;
swap(Var1, Var2);
}
void swap(int &num1, int &num2)
{
int Temp;
Temp = num1;
num1 = num2;
num2 = Temp;
cout<<"After swapping number 1 is "<<num1<<endl;
cout<<"After swapping number 2 is "<<num2<<endl;
}
No comments:
Post a Comment