#include <iostream> #include <string> #include <list> #include <fstream> #include<clocale> #include<iterator> #include <algorithm> using namespace std; struct Kvartira { string raion; int kolvokom; int plosh; int itash; }; struct KvartiraI { string raion2; int kolvokom2; int plosh2; int itash2; }; typedef list<Kvartira> KvartiraList; typedef list<KvartiraI> KvartiraListI; typedef list<Kvartira>::const_iterator ConstIterKvartiraList; typedef list<KvartiraI>::const_iterator ConstIterKvartiraListI; void Print(const KvartiraList& List) { ifstream file("isk.txt"); cout<<file.rdbuf(); cout<<endl; } char MainMenu() { system("cls"); cout << "меню:" <<endl; cout << "\t 1. добавить заявку" << endl; cout << "\t 2. напечатать весь list" << endl; char item = 0; cin >> item; return item; } KvartiraI DataInputI(const KvartiraListI& ListI) { std::ofstream fout("isk.txt",std::ios::app); KvartiraI kvartiraI; getline(std::cin, kvartiraI.raion2); cout << "этаж : "; cin >> kvartiraI.itash2; cout << "площадь: "; cin >> kvartiraI.plosh2; cout << "кол-во комнат: "; cin >> kvartiraI.kolvokom2; fout<<"район "; fout<<kvartiraI.raion2; fout<<" этаж "; fout<<kvartiraI.itash2; fout<<" площадь "; fout<<kvartiraI.plosh2; fout<<" количество комнат "; fout<<kvartiraI.kolvokom2; fout<<std::endl; fout.close(); return kvartiraI; } Kvartira DataInput(const KvartiraList& List)// Ввод данных { std::ofstream fout("isk.txt",std::ios::app); Kvartira kvartira; cout << "район: "; cin.ignore(); getline(std::cin, kvartira.raion); cout << "этаж : "; cin >> kvartira.itash; cout << "площадь: "; cin >> kvartira.plosh; cout << "кол-во комнат: "; cin >> kvartira.kolvokom; cout << "район: "; cin.ignore(); fout<<"район "; fout<<kvartira.raion; fout<<" этаж "; fout<<kvartira.itash; fout<<" площадь "; fout<<kvartira.plosh; fout<<" количество комнат "; fout<<kvartira.kolvokom<< '\n'; fout<<std::endl; fout.close(); return kvartira; } int main() { KvartiraList List; KvartiraListI ListI; KvartiraList kvartiraList; KvartiraListI kvartiraListI; Kvartira kvartira; KvartiraI kvartiraI; setlocale(LC_ALL, "Russian"); size_t n = 0; for(ConstIterKvartiraList iKvartira = List.begin(); iKvartira != List.end();++iKvartira){ for(ConstIterKvartiraListI iKvartira=ListI.begin();iKvartira!=ListI.end();++iKvartira){ if(kvartira.raion==kvartiraI.raion2 && kvartira.itash== kvartiraI.itash2 && kvartira.kolvokom==kvartiraI.kolvokom2 && kvartira.plosh>=(kvartiraI.plosh2)*1.1||kvartira.plosh<=(kvartiraI.plosh2)*1.1||kvartira.plosh==kvartiraI.plosh2){ cout<<"вариант найден"; } }} char answer = 'y'; while (answer == 'y') { switch (MainMenu()) { case '1': kvartiraList.push_front(DataInput(kvartiraList)); kvartiraListI.push_front(DataInputI(kvartiraListI)); //poisk(kvartiraList); break; case '2': Print(kvartiraList); break; default: cout << "такого пункта не существует." << endl; break; } cout << "нажмите'y'для возврата в меню\nнажмите другую клавишу,чтобы выйти "; cin >> answer; } return 0; } 
  • and what is the main override? It's forbidden. - Andrej Levkovitch
  • Information about each apartment contains: number of rooms, area, floor, district. The program must provide a choice using the menu and perform one of the following functions: • input of an exchange request; • search in the card index of a suitable option: if the requirements and proposals for the number of rooms and the number of floors and the difference in the “area” indicator within 10% coincide, the corresponding card is displayed and removed from the list, otherwise the application received is included in the card index; • output the entire card file. - PanaceaTheBest
  • OK, but how can I determine it if I can't even compile it. Need a playable code. - Andrej Levkovitch
  • And why two different, but identical structures? ... - Harry
  • @Andrej Levkovitch oh, and the truth was the problem was this - PanaceaTheBest

0