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--------------------Compilin
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/03 09:48:09
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--------------------Compilin
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)
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--------------------Compilin
错误原因:该宏没有定义
#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