#include <conio.h>
#include <stdio.h>
void countValue(int *a,int *n)
{
int i;
*n=0;
for(i=1;i<=1000;i++)
if((i%7==0&&i%11)||(i%7&&i%11==0))
a[(*n)++]=i;
}
main()
{
int aa[1000],n,k;
system("cls");
countValue(aa,&n);
for(k=0;k<n;k++)
if((k+1)%10==0)printf("\n");
else printf("%5d",aa[k]);
writeDAT();
}
writeDAT()
{
int aa[1000],n,k;
FILE *fp;
fp=fopen("out19.dat","w");
countValue(aa,&n);
for(k=0;k<n;k++)
if((k+1)%10==0) fprintf(fp,"\n");
else fprintf(fp,"%5d",aa[k]);
fprintf(fp,"\n");
fclose(fp);
}--------------------Configuration: fdf - Win32 Debug--------------------
Compiling...
fdf.cpp
c:\users\kent\desktop\ctemp\fdf.cpp(14) : error C2065: 'system' : undeclared identifier
c:\users\kent\desktop\ctemp\fdf.cpp(19) : error C2065: 'writeDAT' : undeclared identifier
c:\users\kent\desktop\ctemp\fdf.cpp(20) : warning C4508: 'main' : function should return a value; 'void' return type assumed
c:\users\kent\desktop\ctemp\fdf.cpp(22) : error C2373: 'writeDAT' : redefinition; different type modifiers
c:\users\kent\desktop\ctemp\fdf.cpp(32) : warning C4508: 'writeDAT' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
咋回事
fdf.obj - 1 error(s), 0 warning(s)