关于debug assertion failed的一点问题
程序如下,编译通过,运行出错。帮帮忙啊大侠们!#include <stdio.h>
#define MAX 200
int a[MAX], b[MAX], cnt = 0;
void jsVal()
{
int l,p,q,r,s,m,n,j,k,temp,h=0;
for(l=0;l<200;l++)
{
p=a[l]/1000;q=(a[l]-p*1000)/100;r=(a[l]-1000*p-q*100)/10;s=(a[l]-p*1000-q*100)%10;
m=p*10+s;n=q*10+r;
if(m*n)
{
if(m%2!=0&&n%2!=0&&(!(m%5!=0&&n%5!=0)))
{
b[h]=a[l];
h++;
cnt++;
}
}
}
for(j=0;j<h-2;j++)
for(k=j+1;k<h-1;k++)
{
if(b[j]<=b[k])
{
temp=b[j];b[j]=b[k];b[k]=temp;
}
}
}
void readDat()
{
int i;
FILE *fp;
fp = fopen("IN.DAT", "r");
for (i=0; i<MAX; i++)
fscanf(fp, "%d,", &a[i]);
fclose(fp);
}
void writeDat()
{
FILE *fp;
int i;
fp = fopen("OUT.DAT", "w");
fprintf(fp, "%d\n", cnt);
for (i=0; i<cnt; i++)
fprintf(fp, "%d\n", b[i]);
fclose(fp);
}
void main()
{
int i;
readDat();
jsVal();
printf("满足条件的数=%d\n", cnt);
for (i=0; i<cnt; i++)
printf("%d ", b[i]);
printf("\n");
writeDat();
}