不使用第三个变量的交换两个数 (笔记)
[cpp]typedef int SWAP_TYPE;
//交换两个数,不使用第三个变量
void swap(int &a,int &b,SWAP_TYPE type)
{
switch(type)
{
case 1: [……]
[cpp]typedef int SWAP_TYPE;
//交换两个数,不使用第三个变量
void swap(int &a,int &b,SWAP_TYPE type)
{
switch(type)
{
case 1: [……]