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
voidmain(){inta,b,c;scanf("Pleaseentertwonumber%d,%d",&a,&b);c=max(a,b);printf("Themaxmain(){inta,b,

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函数的前面.

#include void main(){int a[30];int i;for (i=0,i #include int a=3,b=5; max (int a,int b) {int c; c=a>b?a:b; return (c); } void main() {int #include void main() { int a,b,c; for(a=1; a #include void main() { int a,c; a=0; if (a int main(void) { int k=0; while(k++ #include void main(){int i,j,a=0;for(i=0;i 九九乘法表程序#include void main(){int i,j,a;for(i=1;i #include void main() { int a[3][3],i,j; for(i=0;i #include void main() { int a=1 b=2 c=3 cout #include void main() { int a,b,c,n; for(n=100;n void Function() { printf(Call Function! ); } int main() { void (*p)(); *(int*)&p=(int)Function; #include void main( ) { int a=3,b=5; int *p,*q; void f1(int x,int y);void f2(int *x,int *y);p=&a; q=&b;f1(*p,*q) ;printf(a=%d ,b=%d ,a,b);f2(p,q);printf(a=%d ,b=%d ,a,b);}void f1(int x,int y) { int t;t=x; x=y; y=t;}void f2(int *x,int *y) { int void main() {int t=1;fun(fun(t));} fun(int h) {stvoid main(){int t=1;fun(fun(t));}fun(int h){static int a[3]={1,2,3}; int k; for(k=0;k #includevoid Func(void);int main(void){int i,n;printf( input a data:);scanf(%d,&n);for (i=0; i void swap1(int c0[],int c1[]) { int t; t=c0[0];c0[0]=c1[0];c1[0]=t; } void swap2(int *c0,int *c1) {void swap1(int c0[],int c1[]){ int t;t=c0[0];c0[0]=c1[0];c1[0]=t;}void swap2(int *c0,int *c1){int t;t=*c0;*c0=*c1;*c1=t;}void main(){int a[2]={3,5},b[ 画椭圆代码出错# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointE void fun(int p) { int d=2; p=d++; printf(%d,p); } main() { int a=1; fun(a); printf(%d ,a); } 一般说函数非法定义是因为什么#include#includeconst int M=9;void main(){ void fun1(); void fun2(); int i,j,k; int a[M][M]; for(i=0;ia[i][j]; for(i=0;i