一个自定义函数中可以根据不同情况设置多条return语句?? 对不对呀

如题所述

是这样的,返回值可以根据不同的情况来做处理。例如:
int fun(int a,int b)
{
if (a>b)
return 1;
else if (a == b)
return 0;
else
return -1;
}
温馨提示:答案为网友推荐,仅供参考
相似回答