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

out_file << work->offer->holidays<<endl;

out_file << work->offer->nominal_hours<<endl;

out_file << work->expert -> education<<endl;

out_file << work->expert -> profession<<endl;

out_file << work->expert->total_period<<endl;

out_file << work->expert->length_service << endl;

                     work=work->next;

                                             }

               }

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

             wait_key();

            }

out_file.close();

}

void open_new_list (Vacancy* &end, Vacancy* &begin, char*name_file)

{

Vacancy *Worker;

int count;

char *str=new char [30];

ifstream in_file(name_file);

if (in_file) {  delete_all (end,begin);

                 in_file >> count;

                 for (int i=0; i<count; i++) {

                    Worker=new Vacancy;

                    if (Worker){

in_file >> str;

Worker->name=strdup(str);

Worker->firm=new address;

  in_file >> str;

 Worker-> firm->city  =strdup(str);

 in_file >> str;

 Worker-> firm->street  =strdup(str);

  in_file >> Worker-> firm->house ;

  in_file >> str;

 Worker-> post =strdup(str);

Worker->offer=new conditions_work;

  in_file >> Worker->offer->min_wages ;

in_file >>  Worker->offer->holidays ;

in_file >>  Worker->offer->nominal_hours ;

Worker-> expert =new demand;

  in_file >> str;

 Worker-> expert -> education =strdup(str);

  in_file >> str;

 Worker-> expert -> profession =strdup(str);

  in_file >> Worker-> expert->total_period;

 in_file >> Worker-> expert->length_service;

                                              if (end==NULL) { begin=Worker;

                                        Worker->previous=NULL;

                                      }

                             else   { Worker->previous=end;

                                        end->next=Worker;

                                       }

                       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;

}

void open_add_list (Vacancy* &end, Vacancy* &begin, char *name_file)

{

Vacancy *Worker;

int count;

char *str=new char [30];

ifstream in_file(name_file);

if (in_file) {   in_file >> count;

                 for (int i=0; i<count; i++) {

                    Worker=new Vacancy;

                    if (Worker){

  in_file >> str;

Worker->name=strdup(str);

Worker->firm=new address;

  in_file >> str;

 Worker-> firm->city  =strdup(str);

 in_file >> str;

 Worker-> firm->street  =strdup(str);

  in_file >> Worker-> firm->house ;

  in_file >> str;

 Worker-> post =strdup(str);

Worker->offer=new conditions_work;

  in_file >> Worker-> offer->min_wages ;

in_file >>  Worker-> offer->holidays ;

in_file >>  Worker-> offer->nominal_hours ;

Worker-> expert =new demand;

  in_file >> str;

 Worker-> expert -> education =strdup(str);

  in_file >> str;

 Worker-> expert -> profession =strdup(str);

  in_file >> Worker-> expert->total_period;

 in_file >> Worker-> expert->length_service;

                       if (end==NULL) { begin=Worker;

                                        Worker->previous=NULL;

                                      }

                             else   { Worker->previous=end;

                                        end->next=Worker;