LegoDrifter

Datoteki 8

Jun 17th, 2020
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     FILE *fPointer;
  8.     fPointer = fopen("test.txt","w");
  9.     fprintf(fPointer,"Ova e test za da vidime sedum osum devet deset.\nDali ke raboti nasata programa.\nAko raboti toa e super six seven eight nine deset");
  10.     fclose(fPointer);
  11.  
  12.     FILE *fPointer1;
  13.     fPointer1 = fopen("test.txt","r");
  14.     char *ch;
  15.     int brojacZ=0,voZbor=0;
  16.     int red=1;
  17.  
  18.     while((ch=fgetc(fPointer1))!=EOF)
  19.     {
  20.  
  21.         if(isalpha(ch))
  22.         {
  23.             if(!voZbor)
  24.             {
  25.                 voZbor=1;
  26.             }
  27.         }
  28.         else if(voZbor)
  29.         {
  30.             brojacZ++;
  31.             voZbor=0;
  32.         }
  33.         else if(ch=='\n')
  34.         {
  35.             if(brojacZ>=10)
  36.                 {
  37.                     printf("Redot %d\n",red);
  38.                     red++;
  39.                     brojacZ=0;
  40.                 }
  41.                 else
  42.                 red++;
  43.                 brojacZ=0;
  44.         }
  45.  
  46.     }
  47.     if(voZbor)
  48.     {
  49.         ++brojacZ;
  50.          if(brojacZ>=10)
  51.                 {
  52.                     printf("Redot %d\n",red);
  53.                     red++;
  54.                     brojacZ=0;
  55.                 }
  56.                 else
  57.                 brojacZ=0;
  58.  
  59.     }
  60.  
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment