#include<iostream>
using namespace std;
float max(float,float)://函数的声明写在住函数的前面,因为程序是从上往下执行的。
先声明了,在主函数里就能知道这个东西是函数。
函数的声明一定要写清楚函数返回的类型(float),函数名字 (max),以及参数类型(float,float),不需要写出参数
int main()
{
count<<max(3,4);
return0;
}
float max (float a, float b){
if(a>b)
return a;
else
return b;
}
Keine Kommentare:
Kommentar veröffentlichen