博客园第一次作业

流程图

运算性出来的结果完全不是自己想要的,完全不知道该怎么搞,只会生搬硬套,不懂其所代表的含义;

 

#include<stdio.h>
int main (void)
{
      FILE * text;
      int i,inmax,n;
      char temp;
      int a[10];
      if((text=fopen("C://Users//dell//Desktop.text.txt","a+"))==NULL)
      {
           printf("File open error!\n");

      }
      fscanf(text,("%d%c"),&n,&temp);
      for(i=0;i<n;i++){
            fscanf(text,("%d%c"),&a[i],&temp);
      }
      inmax=0;
     for(i=1;i<n;i++){
         if(a[i]>a[inmax])
         inmax=i;
     }
     printf("%d %d",a[inmax],inmax);
     fprintf(text,"\n%d %d\n",a[inmax],inmax);
     if(fclose(text)){
          printf("Can not close the file!\n");

     }
     return 0;
}

把同学的代码复制过来编译运行,结果和自己的一样,编译错误或者没有结果,没有找到问题出在哪

猜你喜欢

转载自www.cnblogs.com/JCclub/p/10498086.html
今日推荐