求科普:谭浩强书中的例子-比较两个数大小,环境vc++6 编译出错
如题:新手小白一枚,求科普,谢谢!
代码:
#include<stdio.h>
main(){
int a,b,c;
scanf("%d,%d",&a,&b");
c=max(a,b);
printf("max=%d",c);
}
int max(x,y)
int x,y;
{
int z;
if(x>y)z=x;
else z=y;
return 0;
}
vc++6中出错:
d:\m-c\11\11.cpp(4) : error C2001: newline in constant
d:\m-c\11\11.cpp(4) : error C2143: syntax error : missing ')' before 'string'
d:\m-c\11\11.cpp(7) : warning C4508: 'main' : function should return a value; 'void' return type assumed
d:\m-c\11\11.cpp(8) : error C2065: 'x' : undeclared identifier
d:\m-c\11\11.cpp(8) : error C2065: 'y' : undeclared identifier
d:\m-c\11\11.cpp(9) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
d:\m-c\11\11.cpp(9) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
[ 本帖最后由 oldna 于 2013-1-5 20:50 编辑 ]