Advertisement
MattDovi

Pb1

Nov 23rd, 2022
443
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 <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     FILE *in;
  9.     in = fopen("fisier.txt", "rb");
  10.  
  11.     if (in == NULL)
  12.     {
  13.         perror("GRESIT");
  14.         return -1;
  15.     }
  16.  
  17.     int contor = 1;
  18.  
  19.     while(1)
  20.     {
  21.         char c = getc(in);
  22.         if(c == EOF)
  23.             break;
  24.         if(contor % 2 == 1)
  25.             printf("%c", c);
  26.         if(c==10)
  27.             contor++;
  28.     }
  29.     fclose(in);
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement