#include<iostream.h>
void f1(int a,float b)
{
cout<<a+b<<'\n';
return; //A
}
int f2(int a,float b)
{
if(a<b)return a+b;
else return a*b;
}
void main()
{
int x=8;
float y=8.2;
f1(x,y);
cout<<f2(x,y)<<'\n';
void f1(int a,float b)
{
cout<<a+b<<'\n';
return; //A
}
int f2(int a,float b)
{
if(a<b)return a+b;
else return a*b;
}
void main()
{
int x=8;
float y=8.2;
f1(x,y);
cout<<f2(x,y)<<'\n';
}
A行中fl函数的returan语句作用是终止函数的执行,因为fl函数无返回值函数,return后面
只能跟跟分号f2函数有返回值但执行f2函数时只能有一个return被执行。其实函数中有很多
不懂,而且学习过程中对数据类型运用很差需要提高。
明天目标 继续跟进函数