[求助]为什么会这样呢?老是运行错误
输入两个数 使之显示最大的那个#include<stdio.h>
main ()
{
int a;
int b;
int c;
scanf("%d,%d",&a,&b);
c=max (a,b);
printf("max=%d",c);
}
int max (int x, int y)
{ int z;
if (x>y)z=x;
else z=y;
return (z);
}
dev-c++编的,
四个致命错误
`scanf' undeclared (first use this function)
`max' undeclared (first use this function)
`printf' undeclared (first use this function)
`int max(int, int)' used prior to declaration
晕到吐血(我是一个大菜)
[此贴子已经被作者于2005-9-23 14:51:34编辑过]
----------------解决方案--------------------------------------------------------
1、加入:#include <stdio.h>
2、max在使用前声明一下
以上问题可解
----------------解决方案--------------------------------------------------------
谢谢,我试一下看看怎么样
----------------解决方案--------------------------------------------------------
我看没错啊
----------------解决方案--------------------------------------------------------
楼上的打错了文件名,不是加#include<stdio.h>
而是加#include<string.h>才对吧?
你编的子函数没有声明,正如楼上仁兄所说。
如果不想声明就把子函数放到主函数前面吧。
我也只是个菜鸟,有说错的地方还请各位见谅!
----------------解决方案--------------------------------------------------------
成功了,谢谢各位的指教
----------------解决方案--------------------------------------------------------
成功了,谢谢各位的指教
----------------解决方案--------------------------------------------------------