max(max(a,b),c)应该怎么用啊
#include
#include
int main()
{
int a,b,c;
scanf ("%d%d%d",&a,&b,&c);
printf ("%d",a+b+c);
printf ("%.0lf",(a+b+c)/3);
max(max(a,b),c);
return 0;
}
--------------------Configuration:text - Win32 Debug--------------------
Compiling...
book.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\text\book.cpp(9) :error C2065:'max' :undeclared identifier
Error executing cl.exe.
book.obj - 1 error(s),0 warning(s)
人气:340 ℃ 时间:2020-02-05 11:36:52
解答
错误原因:该宏没有定义
#include
使用__max函数代替max
在stdlib.h中有关max定义如下:
/* Non-ANSI names for compatibility */
#ifndef __cplusplus
#define max(a,b)(((a) > (b)) ? (a) : (b))
#define min(a,b)(((a) < (b)) ? (a) : (b))
#endif
推荐
- t=MAX(a+b,c+d)*10
- 如果实数a,b,c满足M{a,b,c}=max{a,b,c} 求证a=b=c
- 用max{a,b,c}表示a,b,c三个数中最大值.
- #include
- △ABC中,a+b=2,S△=a^2+b^2-c^2,求S△Max
- 农民起义有何意义?对历史起推动作用还是倒退?
- 五年级上册习作五的精彩开头
- 在路口A,每25秒红灯变绿灯;在路口B,每30秒红灯变绿灯,如果这两个红灯变绿灯的时间正好都在11:00am,问:下次它们同时变绿灯的时间会是几点?
猜你喜欢