Advertisement
ItsMeLucifer

Zad5 Simin JPO19

Jun 23rd, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 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 ileWystapienZnakuWNapisie(char z, const char * napis) {
  9.     int ile = 0;
  10.     for (int i = 0; i < int(strlen(napis)); i++) {
  11.         if (toupper(z) == toupper(*(napis + i))) {
  12.             ile++;
  13.         }
  14.     }
  15.     return ile;
  16. }
  17. int main()
  18. {
  19.     char z = 'a';
  20.     const char * napis = "Ala Ma Kota";
  21.     int wynik = ileWystapienZnakuWNapisie(z, napis);
  22.     cout << wynik;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement