#include <iostream>
using namespace std; //Allows computer to output data
void swap(int *, int *);
main() //main function begins
{
int x,y;
cout << "Value of X";
cin >> x;
cout << "\nValue of Y";
cin >> y;
swap(&x,&y);
cout << "\nValue of X" << x;
cout << "\nValue of Y" << y;
}//end of main function
void swap(int *a, int *b)
{
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
cout << *a;
cout << *b;
}
using namespace std; //Allows computer to output data
void swap(int *, int *);
main() //main function begins
{
int x,y;
cout << "Value of X";
cin >> x;
cout << "\nValue of Y";
cin >> y;
swap(&x,&y);
cout << "\nValue of X" << x;
cout << "\nValue of Y" << y;
}//end of main function
void swap(int *a, int *b)
{
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
cout << *a;
cout << *b;
}
No comments:
Post a Comment