```cpp
#include<iostream>
using namespace std;
void fun(int x, int y);
int main()
{
int x = 4, y = 7;
fun(x, y);
cout << x << "," << y << endl;
return 0;
}
void fun(int x, int y)
{
x = x + y;
y = x - y;
x = x - y;
cout << x << "," << y << endl;
}
本文通过一个简单的 C++ 程序演示了如何在函数内部交换两个整数变量的值,并展示了如何调用该函数及结果输出。代码中使用了标准输入输出流进行交互展示。

1万+

被折叠的 条评论
为什么被折叠?



