Разработка программы для создания и обработки вакансий в виде двусвязного списка, страница 7

                                       }

                       Worker->next=NULL;

                       end=Worker;

                                  }

                    else { cout << "memory not enough!"<<endl;

                           wait_key();

                           break;

                          }

                                              }

               }

      else { cout << "File not find!" << endl;

             wait_key();

            }

in_file.close();

delete []str;

}

int swap_element(Vacancy* Worker1, Vacancy* &end, Vacancy* &begin)

{

Vacancy *Worker2=Worker1->next;

Vacancy *w_next;

Vacancy *w_previous;

 if (Worker1&&Worker2&&end&&begin) {

if (Worker1==begin) begin=Worker2;

if (Worker2==end) end=Worker1;

w_next=Worker2->next;

w_previous=Worker1->previous;

Worker1->next=w_next;

Worker2->previous=w_previous;

Worker1->previous=Worker2;

Worker2->next=Worker1;

if (Worker1->next) Worker1->next->previous=Worker1;

if (Worker2->previous) Worker2->previous->next=Worker2;

return 0;

                                     }

   else return 1;

}

void orend_of_city(Vacancy* &end, Vacancy* &begin)

 {

Vacancy *end_orend=NULL;

Vacancy *current;

if (end&&begin) {

while (begin->next!=end_orend)

 { current=begin;

 while ((current->next!=end_orend)) {

   if  (strcmp(current->firm->city,current-> next-> firm-> city)>=0)

       swap_element(current,end,begin);

      else current=current->next;

                             }

  if  (!current->next) end_orend=end;

     else end_orend=end_orend->previous;

  }

  }

  }

void orend_of_min_wages(Vacancy* &end, Vacancy* &begin)

 {

Vacancy *end_orend=NULL;

Vacancy *current;

if (end&&begin) {

while (begin->next!=end_orend)

 { current=begin;

 while ((current->next!=end_orend)) {

   if  (current->offer->min_wages-current->next-> offer->min_wages >=0)

       swap_element(current,end,begin);

      else current=current->next;

                             }

  if  (!current->next) end_orend=end;

     else end_orend=end_orend->previous;

  }

  }

  }

void orend_of_education(Vacancy* &end, Vacancy* &begin)

 {

Vacancy *end_orend=NULL;

Vacancy *current;

if (end&&begin) {

while (begin->next!=end_orend)

 { current=begin;

 while ((current->next!=end_orend)) {

   if  (strcmp(current->expert->education,current->next-> expert->education)>=0)

       swap_element(current,end,begin);

      else current=current->next;

                             }

  if  (!current->next) end_orend=end;

     else end_orend=end_orend->previous;

  }

  }

  }

void orend_of_profession(Vacancy* &end, Vacancy* &begin)

 {

Vacancy *end_orend=NULL;

Vacancy *current;

if (end&&begin) {

while (begin->next!=end_orend)

 { current=begin;

 while ((current->next!=end_orend)) {

   if  (strcmp(current-> expert->profession,current->next-> expert->profession)>=0)

       swap_element(current,end,begin);

      else current=current->next;

                             }

  if  (!current->next) end_orend=end;

     else end_orend=end_orend->previous;

  }

  }

  }

void orend_of_post(Vacancy* &end, Vacancy* &begin)

 {

Vacancy *end_orend=NULL;

Vacancy *current;

if (end&&begin) {

while (begin->next!=end_orend)

 { current=begin;

 while ((current->next!=end_orend)) {

   if  (strcmp(current->post,current->next->post)>=0)

       swap_element(current,end,begin);

      else current=current->next;

                             }

  if  (!current->next) end_orend=end;

     else end_orend=end_orend->previous;

  }

  }

  }

void menu_of_orending (Vacancy* &begin, Vacancy* &end)

 {

int inp1;

char *inp2=new char [25];

do {

clrscr();

cout << "RENDORING LIST OF COMPONENTS:" << endl;

cout << " 1 - city" << endl;