Advertisement
Guest User

Untitled

a guest
May 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int iACounter;
  4. int iBCounter;
  5. int iCCounter;
  6.  
  7. int main () {
  8.  
  9. iACounter = 0;
  10. iBCounter = 0;
  11. iCCounter = 0;
  12.  
  13. while (1) {
  14. for (int i = 0; i < 100; i++) {
  15.  
  16. //standardeingabe lesen
  17.  
  18. char c = getchar();
  19.  
  20. switch (c) {
  21.  
  22. case 'A':
  23. iACounter++;
  24. break;
  25. case 'B':
  26. iBCounter++;
  27. break;
  28. case 'C':
  29. iCCounter++;
  30. break;
  31.  
  32. }
  33.  
  34.  
  35. }
  36.  
  37. printf("Es wurden %d A's, %d B's und %d C's ausgegeben",
  38. iACounter, iBCounter, iCCounter);
  39.  
  40. iACounter = iBCounter = iCCounter = 0;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement