#include <iostream>
#include <cstring>
using namespace std;
int checker(string [], int, char);
int main() {
string arr[5];
for(int i = 0; i < 5; i++) {
cout << "Please, enter " << i + 1 << "string: ";
getline(cin, arr[i]);
}
char ch;
cout << "Enter symbol: ";
cin >> ch;
cout << "Quantity of symbol " << ch << " is " << checker(arr, 5, ch);
return 0;
}
int checker(string str[], int a, char ch) {
int number = 0;
for (int i = 0; i < a; i++) {
int len = str[i].length();
for (int j = 0; j < len; j++) {
if (str[i][j] == ch)
number++;
}
}
return number;
}
Comments
Leave a comment