ch9_4.cpp

来自「本文档是(作者:钱能)《C++程序设计教程》系列的部分辅助代码。 选题编辑:张」· C++ 代码 · 共 22 行

CPP
22
字号
//*********************
//**    ch9_4.cpp    **
//*********************

#include <iostream.h>

void swap(int &x,int &y);

void main()
{
  int x=5, y=6;
  cout <<"before swap, x:" <<x <<" ,y:" <<y <<endl;

  swap(x,y);

  cout <<"after swap, x:" <<x <<" ,y:" <<y <<endl;
}

void swap(int &rx,int &ry)
{
  int temp=rx;  rx=ry;  ry=temp;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?