c++里面return的用法
(1)return;
(2)return 0 ;
(3)return 1;
(4)return -1;
(5)return(表达式);
*@*常见的这几种用法:第五个不用说了,我明白了!其上面的四个我还是弄混淆去.如果方便的还可以说得更加详细一点,
人气:197 ℃ 时间:2020-04-22 13:40:28
解答
具体的:
举例说明吧
//比较两个数的大小,返回1,代表x>y,返回0代表两个数相等,返回-1,代表xy)
{
return 1;
}
if (x==y)
{
return 0;
}
if (xy?1:-1;
}
int main(void)
{
int value;
value = max(6.9);//在这里你可以看见你的函数返回值是什么
printf("%d",value);
return 0;
}
现在来说return
return 有两种
1,函数结束不满足当前的值return,
2,函数执行晚可以用return
比如:
void add(x,y)
{
if(x == y)
{
return;
}
else
x--;
return
}
推荐
猜你喜欢
- he was able to walk when he was 10 months old
- 荣誉权究竟属不属于人格权
- 先化简,再求值:(1)2x2-5x x2 4x,其中x=-3 (2)(3x2-xy-2y2)-2(x2 xy-2y2),其中x=6,y=-1
- not in make the a classroom mess do怎么连
- 电子与电荷有什么区别?
- 什么叫农耕文化,什么叫农业文化
- 一个六位数,最高位上数的数是2,百位上的数是最高位上的数的4倍,个位和十位上的数比百位上的数大,其余数位上是0.这个数写作( ).
- give him a cookbook,please.请改为否定句!