Advertisement
lukasd

pliki cwiczenie

Feb 15th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. void kolos1()
  2. {
  3.     FILE *fp;
  4.     FILE *fp2;
  5.     fp = fopen("numery.txt", "r");
  6.     fp2=fopen("dni.txt", "w");
  7.  
  8.     //fseek(fp, -10,SEEK);
  9.    
  10.     int x;
  11.     int wynik = fscanf(fp, "%d", &x);
  12.  
  13.     while (wynik!=EOF)
  14.     {
  15.         printf("%d", x);
  16.         if (x <= 7)
  17.         {
  18.             fprintf(fp2, "%d sobota\n",x);
  19.         }
  20.         else
  21.         {
  22.             fprintf(fp2, "zly wynik\n");
  23.         }
  24.  
  25.  
  26.  
  27.         wynik=fscanf(fp, "%d", &x);
  28.     }
  29.  
  30.  
  31.  
  32.  
  33.     //printf("%d", x);
  34.     fclose(fp);
  35.  
  36.     //FILE *fp;
  37.     //fp = fopen("file.txt", "a+");
  38.     //fprintf(fp, "Ala ma kota");
  39.     //fclose(fp);
  40.     //return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement