ifstream in;
in.open("r.txt");
// Проверка открылся ли файл, если нет, то возвращаем 1
if (!in.is_open()) {
in.close();
cout << "Fail" << endl;
return 1;
}
map<string, string>all;
// Чтение файла до конца
while (!in.eof()) {
string temp;
string larec;
in >> larec;
getline(in, temp);
cout << larec << ' ' << temp << endl;
all[larec] = temp;
}
in.close();
cout << all["Larec1:"] << endl;
return 0;