Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void counter(int zliczacz [256],char input [100]) ;
  4. void statystyka(int zliczacz [256]) ;
  5. int main()
  6. {
  7. char input [100] ;
  8. int zliczacz [256] ;
  9. counter(zliczacz, input) ;
  10. statystyka(zliczacz) ;
  11. return 0;
  12. }
  13.  
  14. void counter(int zliczacz [256],char input [100])
  15. {
  16. int c ;
  17. for(int i = 0 ; i < 256; i++)
  18. zliczacz [i] = 0;
  19. for(int i = 0; (c = getchar()) != EOF && i < 100 && c != '\n'; i++)
  20. {
  21. input [i] = c ;
  22. zliczacz [input[i]]++ ;
  23. }
  24. }
  25. void statystyka(int zliczacz [256])
  26. {
  27. for(int i = 0; i < 256; i++)
  28. printf("%c\t%d\t%d\n", i, i, zliczacz[i]) ;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement