Advertisement
MattDovi

Pb3

Nov 23rd, 2022
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. bool voc(char c)
  6. {
  7.     if(c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u')
  8.         return 1;
  9.     return 0;
  10. }
  11.  
  12. int main()
  13. {
  14.     FILE *in;
  15.     in = fopen("pb3.txt", "rt");
  16.  
  17.     if (in == NULL)
  18.     {
  19.         perror("NU");
  20.         return -1;
  21.     }
  22.  
  23.     char s[101] = {};
  24.     char rez[101][101] = {};
  25.     int k = 0;
  26.     while(fgets(s, 101, in))
  27.     {
  28.             strcpy(rez[k++], s);
  29.     }
  30.  
  31.     fclose(in);
  32.  
  33.     FILE *out;
  34.     out = fopen("pb3out.txt", "w+");
  35.     if (out == NULL)
  36.     {
  37.         perror("NU");
  38.         return -1;
  39.     }
  40.  
  41.     for(int i=k-1; i>=0; i--)
  42.         {
  43.             fprintf(out, "%s", rez[i]);
  44.             //fprintf(out, "\n");
  45.         }
  46.  
  47.     fclose(out);
  48.     return 0;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement