CPlusPlusThings/practical_exercises/10_day_practice/day3/两数交换.cpp
Light-City a4d828bb4c update
2020-04-06 00:57:02 +08:00

22 lines
301 B
C++

#include<iostream>
using namespace std;
void swap(int & a, int & b);
int main(int argc, char const *argv[])
{
int x1(5);
int x2(7);
swap(x1,x2);
cout<<x1<<" "<<x2<<endl;
system("pause");
return 0;
}
void swap(int & a, int & b)
{
int t;
t = a;
a = b;
b = t;
}