简化代码版
#include<iostream>
using namespace std;
void fun(int &a, int&b)
{
int c = 0;
c = a;
a = b;
b = c;
}
int main(void)
{
int x = 10;
int y = 20;
fun(x,y);
cout << x << "," << y << endl;
system("pause");
return 0;
}
#include<iostream>
using namespace std;
void fun(int &a, int&b)
{
int c = 0;
c = a;
a = b;
b = c;
}
int main(void)
{
int x = 10;
int y = 20;
fun(x,y);
cout << x << "," << y << endl;
system("pause");
return 0;
}
2019-10-04
举报