Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Adres {
- int Dom;
- const char* Ulitsa;
- const char* Gorod;
- int index;
- };
- int Index(Adres** arr, int size, int index) {
- for (int i = 0; i < size; i++)
- {
- if (arr[i]->index == index)
- cout << arr[i]->Dom << endl;
- if (arr[i]->index == index)
- cout << arr[i]->Ulitsa << endl;
- if (arr[i]->index == index)
- cout << arr[i]->Gorod << endl;
- }
- return 0;
- }
- int Adress(Adres** arr, int size, int Dom, const char* Ulitsa, const char* Gorod)
- {
- for (int i = 0; i < size; i++)
- {
- if (arr[i]->Ulitsa == Ulitsa && Dom == Dom && Gorod == Gorod)
- cout << arr[i]->index << endl;
- }
- return 0;
- }
- int main() {
- Adres* arr[23] = { new Adres(), new Adres(),new Adres() };
- arr[0]->Dom = 14;
- arr[0]->Ulitsa = "Festivalynaya";
- arr[0]->Gorod = "Kasimov";
- arr[0]->index = 110542;
- arr[1]->Dom= 88;
- arr[1]->Ulitsa = "Volokamskaya";
- arr[1]->Gorod = "Moskva";
- arr[1]->index = 606674;
- arr[2]->Dom = 18;
- arr[2]->Ulitsa = "Krasnaya";
- arr[2]->Gorod = "Novgorod";
- arr[2]->index = 391303;
- Index(arr, sizeof(arr) / sizeof(arr[0]),1);
- Adress(arr, sizeof(arr) / sizeof(arr[0]),14,"Festivalynaya","Kasimov");
- delete arr[0];
- delete arr[1];
- delete arr[2];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement