userdefined函数中的返回类型bool没有返回任何内容?

编程入门 行业动态 更新时间:2024-10-19 22:41:10
本文介绍了userdefined函数中的返回类型bool没有返回任何内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的程序没有返回任何值...当我尝试在不使用用户定义函数的情况下解决此问题并使用printf()输出消息该三角形是否有效时,其工作 我的尝试:

my program is not returning any value...when i try to solve this problem without using user defined function and use printf() to output the message "that triangle is valid or not" ,its working What I have tried:

#include<stdio.h> #include <stdbool.h> bool triangle( int a,int b,int c); int main(void){ printf("enter three side of triangel to check if triangle exist\n"); int x=get_int(); int y=get_int(); int z=get_int(); triangle(x,y,z); } bool triangle( int a,int b,int c) { if((a>0&&b>0&&c>0)&&(a+b>c&&b+c>a&&a+c>a)){return true;} else{ return false;}}

推荐答案

函数DOES返回一个值。你只是没有抓住它并用它做任何事情。 你打电话给三角形(x,y,z); 不捕获返回值。它应该是 The function DOES return a value. You're just not capturing it and doing anything with it. Your call to triangle(x,y,z); doesn't capture the return value. It should be bool c; c = triangle(x,y,z); ...

更多推荐

userdefined函数中的返回类型bool没有返回任何内容?

本文发布于:2023-11-06 13:51:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   类型   内容   userdefined   bool

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!