void main() { int a,b,c; scanf("Please enter two number %d,%d",&a,&b); c=max(a,b); printf("The max main(){ int a,b,c;scanf("Please enter two number %d,%d",&a,&b);c=max(a,b);printf("The max number is %d\n",c);}int max(int x,int y){ int z;if(x>y) z=x;e
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 00:49:24
void main() { int a,b,c; scanf("Please enter two number %d,%d",&a,&b); c=max(a,b); printf("The max main(){ int a,b,c;scanf("Please enter two number %d,%d",&a,&b);c=max(a,b);printf("The max number is %d\n",c);}int max(int x,int y){ int z;if(x>y) z=x;e
void main() { int a,b,c; scanf("Please enter two number %d,%d",&a,&b); c=max(a,b); printf("The max
main()
{ int a,b,c;
scanf("Please enter two number %d,%d",&a,&b);
c=max(a,b);
printf("The max number is %d\n",c);
}
int max(int x,int y)
{ int z;
if(x>y) z=x;
else z=y;
return(z);
}
出错提示是这样的
undefined symbol '_main' in module COS
我只想有人给解释一下,我的错在哪了?如何修改呀?
void main() { int a,b,c; scanf("Please enter two number %d,%d",&a,&b); c=max(a,b); printf("The max main(){ int a,b,c;scanf("Please enter two number %d,%d",&a,&b);c=max(a,b);printf("The max number is %d\n",c);}int max(int x,int y){ int z;if(x>y) z=x;e
这个错误的原因在于,你在使用max函数时没有对他进行申明,换句话说,main函数使用他时,找不到他,你可以在main函数前先对其进行申明,再使用,实现可以放在main函数后面,如下:
#include
int max(int x, int y);
void main()
{ int a,b,c;
scanf("Please enter two number %d,%d",&a,&b);
c=max(a,b);
printf("The max number is %d\n",c);
}
int max(int x,int y)
{ int z;
if(x>y) z=x;
else z=y;
return(z);
}
也可以像楼上那样直接把max函数的申明和实现都放在main函数的前面.