Advertisement
kk258966

5/7 C++ 作業

May 7th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 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[20];
  7.     FILE *read;
  8.     read=fopen("random.txt","r");
  9.    
  10.     while((fscanf(read,"%d",&b))!=EOF)  
  11.     {
  12.           no[count]=b;
  13.           count++;
  14.           if(b>40 && b%2!=0)
  15.          {                            
  16.          printf("no[%d]=%d\n",count,b);
  17.          }
  18.          
  19.     }
  20.    
  21.    
  22.     fclose(read);
  23.      
  24.    
  25.  
  26.     system("pause");
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement