#include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent *Owner) : TForm(Owner) { } void __fastcall TForm1::AddButtonClick(TObject *Sender) { AnsiString postalCode = PostalCodeEdit->Text; AnsiString location = LocationEdit->Text; if (postalCode != "" && location != "") { PostalCodeDirectory[postalCode] = location; ShowMessage(L"Запись добавлена: " + postalCode + L" - " + location); ClearFields(); } else { ShowMessage(L"Введите индекс и населенный пункт."); } } void __fastcall TForm1::SearchButtonClick(TObject *Sender) { AnsiString searchPostalCode = SearchEdit->Text; if (searchPostalCode != "") { std::map<AnsiString, AnsiString>::iterator it = PostalCodeDirectory.find(searchPostalCode.c_str()); if (it != PostalCodeDirectory.end()) { ShowMessage(L"Населенный пункт для индекса " + String(it->first.c_str()) + L": " + String(it->second.c_str())); } else { ShowMessage(L"Запись для индекса " + searchPostalCode + L" не найдена."); } } else { ShowMessage(L"Введите индекс для поиска."); } } void __fastcall TForm1::ClearFields() { PostalCodeEdit->Clear(); LocationEdit->Clear(); SearchEdit->Clear(); } C #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent *Owner) : TForm(Owner) { } void __fastcall TForm1::AddButtonClick(TObject *Sender) { AnsiString postalCode = PostalCodeEdit->Text; AnsiString location = LocationEdit->Text; if (postalCode != "" && location != "") { PostalCodeDirectory[postalCode] = location; ShowMessage(L"Запись добавлена: " + postalCode + L" - " + location); ClearFields(); } else { ShowMessage(L"Введите индекс и населенный пункт."); } } void __fastcall TForm1::SearchButtonClick(TObject *Sender) { AnsiString searchPostalCode = SearchEdit->Text; if (searchPostalCode != "") { std::map<AnsiString, AnsiString>::iterator it = PostalCodeDirectory.find(searchPostalCode.c_str()); if (it != PostalCodeDirectory.end()) { ShowMessage(L"Населенный пункт для индекса " + String(it->first.c_str()) + L": " + String(it->second.c_str())); } else { ShowMessage(L"Запись для индекса " + searchPostalCode + L" не найдена."); } } else { ShowMessage(L"Введите индекс для поиска."); } } void __fastcall TForm1::ClearFields() { PostalCodeEdit->Clear(); LocationEdit->Clear(); SearchEdit->Clear(); } делаю код для уника, не могу его сделать, пишет ошибки всегда вот вторая часть #ifndef Unit1H #define Unit1H #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <map> class TForm1 : public TForm { __published: // IDE-managed Components TLabel *Label1; TLabel *Label2; TLabel *Label3; TEdit *PostalCodeEdit; TEdit *LocationEdit; TButton *AddButton; TButton *SearchButton; TEdit *SearchEdit; TLabel *ResultLabel; void __fastcall AddButtonClick(TObject *Sender); void __fastcall SearchButtonClick(TObject *Sender); private: // User declarations std::map<AnsiString, AnsiString> PostalCodeDirectory; void __fastcall ClearFields(); public: // User declarations __fastcall TForm1(TComponent *Owner); }; extern PACKAGE TForm1 *Form1; #endif C #ifndef Unit1H #define Unit1H #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <map> class TForm1 : public TForm { __published: // IDE-managed Components TLabel *Label1; TLabel *Label2; TLabel *Label3; TEdit *PostalCodeEdit; TEdit *LocationEdit; TButton *AddButton; TButton *SearchButton; TEdit *SearchEdit; TLabel *ResultLabel; void __fastcall AddButtonClick(TObject *Sender); void __fastcall SearchButtonClick(TObject *Sender); private: // User declarations std::map<AnsiString, AnsiString> PostalCodeDirectory; void __fastcall ClearFields(); public: // User declarations __fastcall TForm1(TComponent *Owner); }; extern PACKAGE TForm1 *Form1; #endif с++ builder6