Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // uloha7-7.c -- Lucia Rapánová, 7.11.2018 12:16
- #include <stdio.h>
- int main()
- {
- int riadok = 0;
- int i=0;
- int j;
- int pocty[26];
- for (i=0; i<26; i++) pocty[i]=0;
- FILE *subor;
- char z,a;
- subor=fopen("subor.txt","r");
- printf(" ");
- for (a='A'; a<='Z'; a++) printf("%c ", a);
- printf("\n");
- while (fscanf(subor, "%c", &z) > 0)
- {
- if (z>='A' && z<='Z' || z>='a' && z<='z') pocty[z-'a']++;
- if (z=='\n' || z==EOF)
- {
- riadok++;
- printf("%d ", riadok);
- for (j=0; j<26; j++) printf("%d ", pocty[j]);
- printf("\n");
- for (i=0; i<26; i++)
- pocty[i]=0;
- }
- }
- fclose(subor);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement