解题思路:
注意事项:
参考代码:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
float function(float a, float b, float c);
#define find_max(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))//用一个三目运算符
int main()
{
float a = 0;
float b = 0;
float c = 0;
float max = 0;
scanf("%f%f%f", &a, &b, &c);
printf("%.3f\n", function(a, b, c));
printf("%.3f", find_max(a,b,c));
}
float function(float a, float b, float c)
{
float ret = 0;
float max = 0;
if (a < b)
{
max = b;
}
else
{
max = a;
}
if (max < c)
{
ret = c;
}
else
{
ret = max;
}
return ret;//保证函数的单一出口性
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.2 (Java代码)浏览:2278 |
A+B for Input-Output Practice (C++代码)浏览:623 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:398 |
P1001 (C语言代码)浏览:830 |
简单的a+b (C语言代码)浏览:628 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:610 |
本人酷爱递归实现很多问题,这里也是浏览:588 |
WU-格式化数据输出 (C++代码)浏览:1295 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:638 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:2108 |