p4_2.cpp
来自「相当丰富的C++源码」· C++ 代码 · 共 20 行
CPP
20 行
/***********************************************
* p4_2.cpp *
* 函数的传值调用, 将两个数交换 *
************************************************/
#include<iostream>
using namespace std;
void swap(int a,int b)
{
int t;
t=a, a=b, b=t;
}
void main()
{
int x=7,y=11;
cout<<"x="<<x<<" y="<<y<<endl;
swap(x,y);
cout<<"after swap:";
cout<<"x="<<x<<" y="<<y<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?