Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. void countChar() {
  2.     int count = 0;
  3.     for (int i = 0; i < strlen(str); i++) {
  4.         if (!str[i])
  5.             continue;
  6.         for (int j = i + 1; j < strlen(str); j++) {
  7.             if (str[i] == str[j]) {
  8.                 count++;
  9.             }
  10.         }
  11.         printf("\n %c occurs : %d times", str[i], count);
  12.         count = 1;
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement