Advertisement
ItsMeLucifer

Zad6 Simin JPO19

Jun 23rd, 2019
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <cctype>
  5.  
  6. using namespace std;
  7.  
  8. int najczesciejWystepujacaLitera(const char * napis) {
  9.     int ile = 0,ile2=0;
  10.     char litera;
  11.     for (int i = 0; i < int(strlen(napis)); i++) {
  12.         for (int k = 1; k < int(strlen(napis)); i++) {
  13.             if (tolower(*(napis+i)) == tolower(*(napis+k))) {
  14.                 ile++;
  15.             }
  16.         }
  17.         if (ile > ile2) {
  18.             litera = *(napis + i);
  19.             ile2 = ile;
  20.         }
  21.     }
  22.     return ile;
  23. }
  24. int main()
  25. {
  26.     int wynik = najczesciejWystepujacaLitera("Ala Ma Kota");
  27.     cout << wynik;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement