#include "stdafx.h"
#include<Windows.h>
#include<iostream>
using namespace std;
//函数:一串可以重复执行的代码
//函数定义:返回类型+函数的名字( 形参1类型+形参1名字||形参2类型+形参2名字,){函数体}
//返回值:函数执行万i后,会返回想听的结果给外部使用)
//形参: 个数,可以很多个,也可以没有
//函数调用: 函数名(实参1,实参2)
//引用:变量的别名,变量有2个名字
//定义引用:引用类型+&+
void JudgeMax(int x, int y);//求最大值
void Swap(int a, int y);//交换2个值
int main()
{
int a=5, b=6;
int& ia = a;
ia = 7;
JudgeMax(a, b);
Swap(a, b);
//引用
return 0;
}
void JudgeMax(int x, int y)
{
int iMax = y;
if (x >= y)
{
iMax = x;
}
cout << iMax<<endl;
//return iMax;
}
void Swap(int x, int y)
{
x = x + y;
y = x - y;
x = x - y;
cout << x << y;
}