📄 noswap.cpp
字号:
// incorrect swap method
#include<iostream>
using namespace std;
void swap(int x, int y)
{// swap the integers x and y
int temp = x;
x = y;
y = temp;
}
// test the swap function
int main()
{
int a = 2;
int b = 3;
// output the values
cout << "Before swapping, a = " << a << " b = " << b << endl;
// swap a and b
swap(a,b);
// output the new values
cout << "After swapping, a = " << a << " b = " << b << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -