25 lines
313 B
C++
25 lines
313 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int countX (const char *p, const char *x) {
|
|
if (p==nullptr) {
|
|
return 0;
|
|
}
|
|
|
|
int count = 0;
|
|
|
|
for (; *p != 0; p++) {
|
|
if (*p == *x) {
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
|
|
int main (void) {
|
|
cout << countX("Haaay, Koray", "a") << endl;
|
|
|
|
return 0;
|
|
}
|