Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string>
- #include <cctype>
- using namespace std;
- int ileWystapienZnakuWNapisie(char z, const char * napis) {
- int ile = 0;
- for (int i = 0; i < int(strlen(napis)); i++) {
- if (toupper(z) == toupper(*(napis + i))) {
- ile++;
- }
- }
- return ile;
- }
- int main()
- {
- char z = 'a';
- const char * napis = "Ala Ma Kota";
- int wynik = ileWystapienZnakuWNapisie(z, napis);
- cout << wynik;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement