Практика 3 задание 3
Tue Oct 08 2024 19:01:49 GMT+0000 (Coordinated Universal Time)
Saved by
@Yakostoch
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
unsigned count{}; // счетчик, указывающий колличество определенного символа в фамилии
string sname;
cout << "Введите вашу фамилию: ";
getline(cin, sname);
for (const char k : sname)
{
if (k == 'б' or k == 'Б')
{
count++;
}
}
cout << "Количество вхождений буквы: " << count << endl;
}
content_copyCOPY
Comments