一个程序在VC运行不了!高手帮改下!谢拉!
--------------------Configuration: PROG - Win32 Debug--------------------Linking...
PROG.OBJ : error LNK2001: unresolved external symbol _isprime
Debug/PROG.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
PROG.exe - 2 error(s), 0 warning(s)
-----------------------------------------------------------------------------------------------------
#include<stdio.h>
int a[300],b[300],cnt=0;
void readDat();
void writeDat();
int isP(int m)
{
int i;
for(i=2;i<m;i++)
if(m%i==0) return 0;
return 1;
}
void jsValue()
{
int i,j;
int temp;
for(i=0;i<300;i++)
if(isprime(a[i]))
{
b[cnt]=a[i];
cnt++;
}
for(i=0;i<cnt-1;i++)
for(j=i+1;j<cnt;j++)
if(b[i]>b[j])
{
temp=b[i];
b[i]=b[j];
b[j]=temp;
}
}
void main()
{
int i;
readDat();
jsValue();
writeDat();
printf("cnt=%d\n",cnt);
for(i=0;i<cnt;i++)
printf("b[%d]=%d\n",i,b[i]);
}
void readDat()
{
FILE *fp;
int i;
fp=fopen("IN39.DAT","r");
for(i=0;i<300;i++)
fscanf(fp,"%d,",&a[i]);
fclose(fp);
}
void writeDat()
{
FILE *fp;
int i;
fp=fopen("OUT39.DAT","w");
fprintf(fp,"%d\n",cnt);
for(i=0;i<cnt;i++)
fprintf(fp, "%d\n",b[i]);
fclose(fp);
}