int max(int a,int b);
main()
{
int x,y,z;
int max(int a,int b);
printf("input two numbers:\n");
scanf("%d%d",&x,&y);
z = max(x,y);
printf("maxmum=%d",z);
}
int max(int a,int b)
{
if(a>b)return a;else return b;
}
编译器:Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/sin.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
sin.exe - 1 error(s), 0 warning(s)
Compiling...
sin.cpp
F:\sin\sin.cpp(6) : error C2065: 'printf' : undeclared identifier
F:\sin\sin.cpp(7) : error C2065: 'scanf' : undeclared identifier
F:\sin\sin.cpp(10) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
把main中的int max(int a,int b);删除。
请在int max(int a,int b);前面加一句#include <stdio.h>。
把main()改成int main()。
在printf("maxmum=%d",z);后加一句return 0;。
谢谢
本回答被提问者采纳