Код: Выделить всё
int count_char(string a, char b)
{
int size = sizeof(a) / sizeof(a[0]);
int counter = 0;
for (int i = 0; i < size; i++)
{
if (a[i] == b)
{
counter++;
}
}
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79012046/how-many-times-a-char-is-repeated-in-a-string-string-subscript-out-of-range-e[/url]