错误印刷价值屏幕。最高最低值

编程入门 行业动态 更新时间:2024-10-24 16:32:09
本文介绍了错误印刷价值屏幕。最高最低值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我写一个简单的code,它有两个数字输入并告诉我这是最高值,这是使用2个单独的文件功能最小值。这里是我的code为止。它扫描的数量和具有正确的最大最小,但是当我去打印值一个疯狂的打印数量。

I am writing an easy code that takes two numbers I enter and tells me which is the Max value and which is the Min value using 2 separate files for functions. here is my code so far. It scans the number and has the correct Max Min but when I go to print the values a crazy number prints.

#include<stdio.h> int main(void) { double num2, max, min, num1; printf("enter any space-separated pair of decimal numeric values on the same line: "); scanf("%le%le", &num1, &num2); max = ComputeMaximum(num1, num2); min = ComputeMinimum(num1, num2); printf("%le", max); printf("%le", min); return 0; }

这是我的主要项目,在同一个项目中,我有单独的文件:

this is my main program, on seperate files in the same project I have:

double ComputeMinimum(double num1, double num2) { double result; result = (num1 < num2) ? num1 : num2; return result; }

double ComputeMaximum(double num1, double num2) { double result; result = (num1 > num2) ? num1 : num2; return result; }

我想有它打印到屏幕:ComputeMinimum(?,?)回来?结果ComputeMaximum(?,?)返回? (问号是值。)

I would like to have it print to screen: ComputeMinimum(?, ?) returned ? ComputeMaximum(?, ?) returned ? (question marks are the values.)

推荐答案

code丢失的原型。

Code is missing prototypes.

这就是全部,格式是确定的,功能正常。

That is all, format is OK, functions are OK.

#include<stdio.h> // Add these to the same file as main() // Or better yet, add to another file Compute.h and #include "Compute.h" // here and in the the separate C file double ComputeMinimum(double num1, double num2); double ComputeMaximum(double num1, double num2); int main(void) ... // suggest adding check if (2 != scanf("%le%le", &num1, &num2)) { puts("Input error"); return -1; }

更多推荐

错误印刷价值屏幕。最高最低值

本文发布于:2023-11-22 20:05:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1618820.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:屏幕   错误   价值   低值

发布评论

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

>www.elefans.com

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