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

                                   Worker->next->previous=NULL;

                                  }

 if ((Worker->next==NULL)&&(begin!=NULL)) Worker->previous->next=NULL;

 if ((Worker->next!=NULL)&&(Worker->previous!=NULL))

                                   {Worker->previous->next=Worker->next;

                                    Worker->next->previous=Worker->previous;}

 work=Worker->previous;

 delete []Worker->name;

 delete []Worker-> firm->city;

 delete []Worker-> firm->street  ;

  delete Worker-> firm;

  delete []Worker-> post;

  delete Worker->offer;

 delete []Worker-> expert -> education;

delete []Worker-> expert -> profession;

delete Worker->expert;

 delete Worker;

 Worker=work;

 return work;

 }

Vacancy* find_to_end (Vacancy* begin)

{

Vacancy* work=begin;

if (work!=NULL) while ((work->next!=NULL))

                   work=work->next;

return work;

}

int count_to_list (Vacancy* begin)

{

int count=1;

Vacancy* work=begin;

if (work==NULL) count=0;

   else while (work=work->next) count++;

return count;

}

Vacancy* delete_all (Vacancy* &end, Vacancy* &begin)

{

while (begin!=NULL)

    if (end==NULL) end=find_to_end(begin);

       else delete_element (end, begin);

return end;

}

int wait_key(void)

{//while (!kbhit());

  return getch();

}

Vacancy* new_list (Vacancy* &end, Vacancy* &begin)

{

if (begin!=NULL) { end=find_to_end(begin);

                   delete_all(end,begin);

                  }

int code;

cout <<endl;

do {

cout <<"Input new element?(Y/N)"<<endl;

do code=wait_key();

  while((code!=78)&&(code!=89)&&(code!=110)&&(code!=121));

if ((code==89)||(code==121)) { cout <<"Input data of "<<count_to_list(begin)+1<<" element:"<<endl;

  if (begin==NULL) begin=input_new(end);

            else input_new(end);

                             }

    }

   while((code==89)||(code==121));

cout << "Count to elements of list:"<<count_to_list (begin)<<endl;

wait_key();

return end;

}

Vacancy* line_find_to_city (Vacancy* current, char* str)

{

Vacancy* work=current;

while (work!=NULL)

  if  (strcmp(work->firm->city,str)) work=work->next;

       else break;

return work;

}

int line_find_to_city_all (Vacancy* begin, char* str)

{

int count=0;

Vacancy* work=begin;

while (work!=NULL)

  if  (strcmp(work-> firm->city,str)) work=work->next;

       else { cout <<work;

              work=work->next;

              count ++;

             }

return count;

}

Vacancy* line_find_to_min_wages (Vacancy* current, int value)

{

Vacancy* work=current;

while (work!=NULL)

  if  (work-> offer->min_wages!=value) work=work->next;

       else break;

return work;

}

int line_find_to_min_wages_all (Vacancy* begin, int value)

{

int count=0;

Vacancy* work=begin;

while (work!=NULL)

  if  (work-> offer->min_wages!=value) work=work->next;

       else { cout <<work;

              work=work->next;

              count ++;

             }

return count;

}

Vacancy* line_find_to_education (Vacancy* current, char* str)

{

Vacancy* work=current;

while (work!=NULL)

  if  (strcmp(work-> expert->education,str)) work=work->next;

       else break;

return work;

}

int line_find_to_education_all (Vacancy* begin, char* str)

{

int count=0;

Vacancy* work=begin;

while (work!=NULL)

  if  (strcmp(work-> expert->education,str)) work=work->next;

       else { cout <<work;

              work=work->next;

              count ++;

             }

return count;

}

Vacancy* line_find_to_profession (Vacancy* current, char* str)

{

Vacancy* work=current;

while (work!=NULL)

  if  (strcmp(work-> expert ->profession,str)) work=work->next;

       else break;

return work;

}

int line_find_to_profession_all (Vacancy* begin, char* str)

{

int count=0;

Vacancy* work=begin;

while (work!=NULL)

  if  (strcmp(work-> expert -> profession,str)) work=work->next;