#include <iostream>
#include <fstream>
int main() {
std::fstream F;
F.open("text.txt", std::ios::in);
if(!F.is_open())
std::cout << "Ошибка открытия файла" << std::endl;
else{
char beg = 'p';
std::string temp;
int n=0;
while(std::getline(F, temp)) {
if (temp.front() == beg) n++;
}
std::cout << n << " строк начинается на букву 'p'" << std::endl;
}
F.close();
return 0;
}
op
pi
vc
za
pr
gl
vo
kr
le
po