Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char s[200];
- int c = 0, szam1[26] = {0}, x = 0, space = 0;
- int b = 0, szam2[26] = {0}, y = 0, pont = 0;
- printf("Adja meg a kivant szoveget: \n");
- gets(s);
- while (s[c] != '\0') {
- if (s[c] >= 'a' && s[c] <= 'z') {
- x = s[c] - 'a';
- szam1[x]++;
- }
- c++;
- if (s[b] >= 'A' && s[b] <= 'Z'){
- y = s[b] - 'A';
- szam2[y]++;
- }
- b++;
- // space és pont.
- if (s[b] == '.'){
- pont++;
- }
- b++;
- if (s[c] == ' '){
- space++;
- c++;
- }
- }
- for (c = 0; c < 26; c++)
- printf("%c : %d db\n", c + 'a', szam1[c]);
- for (b = 0; b < 26; b++)
- printf("%c : %d db\n", b + 'A', szam2[b]);
- printf(". : %d db\n", pont);
- printf(" : %d db\n", space);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement