Advertisement
kk258966

10/31 進階程式設計 練習二

Oct 31st, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. int main(void)
  5. {
  6.    
  7.    
  8.     int i,j;
  9.    
  10.     //////////////////////讀檔///////////////////
  11.    
  12.    
  13.  printf("**讀成績檔**\n\n");
  14.  FILE *read01;
  15.  int line[11][100];
  16.  
  17.  int count=1;
  18.  read01=fopen("score.txt","r");
  19.  
  20.  while(! feof(read01))
  21.  {
  22.     fscanf(read01,"%d %d %d %d %d\n",&line[count][1],&line[count][2],&line[count][3],&line[count][4],&line[count][5]) ;    
  23.     count++;    
  24.  }
  25.  fclose(read01);
  26.  
  27. for(i=1;i<count;i++)
  28. {
  29.   for(j=1;j<=5;j++)
  30.   printf("line[%d][%d]=%d   ",i,j,line[i][j]);
  31.   printf("\n===================================\n")  ;                
  32. }
  33.  
  34.  
  35.     system("pause");
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement