#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream xtx("file.txt"); ofstream f2; f2.open("file1.txt"); string s; while (!xtx.eof()) { getline (xtx,s); if(s=="Lieutenant") { cout<<s; f2<<s<<endl; } } cout<<endl; xtx.close(); f2.close(); return 0; } Код #include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream xtx("file.txt"); ofstream f2; f2.open("file1.txt"); string s; while (!xtx.eof()) { getline (xtx,s); if(s=="Lieutenant") { cout<<s; f2<<s<<endl; } } cout<<endl; xtx.close(); f2.close(); return 0; } «Военнослужащий»: звание; фамилия; имя; отчество; домашний адрес дата рождения (год, месяц число); номер телефона. Вывести данные про военнослужащих в звании “лейтенант”. Записать эти сведения в новый файл