Advertisement
kk258966

5/7 C++ 練習四

May 7th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void)
  4. {
  5.     int b,count=1;
  6.     int no[10];
  7.     FILE *read;
  8.     read=fopen("input.txt","r");
  9.    
  10.     while((fscanf(read,"%d",&b))!=EOF)  
  11.     {
  12.           no[count]=b;
  13.                
  14.          
  15.           count++;
  16.          
  17.     }
  18.    
  19.     int i;
  20.     for(i=1;i<count;i++)
  21.     {
  22.        printf("no[%d]=%d\n",i,no[i]);
  23.                      
  24.     }
  25.    
  26.     fclose(read);
  27.      
  28.    
  29.  
  30.     system("pause");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement