新手求助 下面哪个程序 哪里出错了 没有输出
102.345 8.605 2.876 0.919 4.455 7.289 7.390 6.276 1.298 7.773
3
#include<stdio.h>
FILE *fr,*fw;
void kai();
void guan();
void kai()
{
fr=fopen("20161203c22.in","r");
fw=fopen("20161203c22.out","w");
}
void guan()
{
fclose(fr);
fclose(fw);
}
main()
{
kai();
float s,b;
long i,n,x,a,c,d,f,m;
fscanf(fr,"%d",&n);
for(i=1;i<=n;++i)
fscanf(fr,"%f",&s);
fscanf(fr,"%d",&x);
for(i=1;i<=n;++i)
{
b=(int)s;
a=s-b;
}
m=0;
for(i=1;i<=n;++i)
{
a=a*10;
c=(int)a;
if(c==x){++m;f=i;}
}
for(i=1;i<=m;++i)
if(m==0) fprintf(fw,"-1");
else fprintf(fw,"%5d",f);
guan();
} 第一个不需要取证
页:
[1]