Advertisement
machkovskitomche

datoteka

Sep 1st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. #include<ctype.h>
  5. #define max 80
  6.  
  7. int main(int argc,char *argv[])
  8. {
  9.     if(argc!=2)
  10.     {
  11.         printf("GRESKA\n");
  12.         return -1;
  13.     }
  14.     FILE *in1;
  15.     char s[max],*c;
  16.     int red,vozbor=0,zbor;
  17.     in1=fopen(argv[1],"r");
  18.     if(in1==NULL)
  19.     {
  20.         printf("NEMA TAKVA DATOTEKA\nUpatstvo%s\t",argv[0]);
  21.         return -1;
  22.     }
  23.     while(fgets(s,max,in1)!=NULL)
  24.     {
  25.         c=s;
  26.         zbor=vozbor=0;
  27.         while(*c!='\n')
  28.         {
  29.             if(isalnum(*c))
  30.             {
  31.                 if(vozbor==0)
  32.                     vozbor=1;
  33.                 }
  34.                 else
  35.                     if(vozbor!=0)
  36.                 {
  37.                     vozbor=0;
  38.                     zbor++;
  39.                 }
  40.                 c++;
  41.         }
  42.             if (vozbor!=0) zbor++;
  43. if (zbor >= 10) red++;
  44.     }
  45. printf("Vkupno %d redovi imaat povekje od 10 zborovi\n",red);
  46. return(0);
  47. }
  48. //datoteka broj kolku reda imat povekje od 2 zborovi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement