主题:请问这是哪里错了
#include<stdio.h>
#include<process.h>
long fn(long n)
{
long temp=0;
int j=1,i=1,flag=1;
if(n<=0)
{
printf("error: n must > 0");
exit(1);
}
while(j<=n)
{
temp=temp+i;
i=-i;
i>0?i++:i--;
j++;
}
return temp;
}
显示的结果是:
Compiling...
Cpp1.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cpp1.exe - 2 error(s), 0 warning(s)
#include<process.h>
long fn(long n)
{
long temp=0;
int j=1,i=1,flag=1;
if(n<=0)
{
printf("error: n must > 0");
exit(1);
}
while(j<=n)
{
temp=temp+i;
i=-i;
i>0?i++:i--;
j++;
}
return temp;
}
显示的结果是:
Compiling...
Cpp1.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cpp1.exe - 2 error(s), 0 warning(s)