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

        out_file << work->name     << endl;

        out_file << work->amount      << endl;

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

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

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

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

        out_file << work->proffs -> name         << endl;

        out_file << work->proffs -> from        << endl;

        out_file << work->proffs -> competition         << endl;

        out_file << work->proffs ->size_pay           << endl;

             work=work->next;

       }

   }

 else

   {

    cout << "File not find!" << endl;      //inache vuvod ne vozmojen

    wait_key();

   }

 out_file.close();                         //zakrut' potok

}

//otkrut' novui spisok is faila

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

{

 educational *ed;

 int count;

 char *str=new char [60];

 ifstream in_file(name_file);              //svyazat' fail

 if(in_file)                               //esli fail sushestvyet

   {

    delete_all (end,begin);                //ydalit' tekyshii spisok

    in_file >> count;                    //prochitat' kol-vo elementov v spiske

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

       {

        ed=new educational;              //vudelyaem mesto pod novui element

        if(ed)                           //esli dali mesto

          {                               //to chitaem dannue elementa is faila

 ed-> proffs =new profession;

 ed-> education =new address;

            in_file >> str;

            ed->division =strdup(str);  

            in_file >> str;

            ed->direction =strdup(str);

            in_file >> str;

            ed->name =strdup(str);

            in_file >>ed->amount ;

            in_file >>ed->education->post_index;

                                 in_file >> str;

            ed->education -> city=strdup(str);

            in_file >> str;

            ed->education -> street=strdup(str);

                                 in_file >>ed->education -> house;

            in_file >> str;

            ed->proffs -> name=strdup(str);

                                 in_file >> str;

            ed->proffs -> from=strdup(str);

            in_file >>ed->proffs -> competition;          

            in_file >>ed->proffs ->size_pay;

            if(end==NULL)                  //esli pervui element

              {

                begin=ed;

                ed->previous=NULL;

              }

                      else                           //drugoi

              {

                ed->previous=end;

                end->next=ed;

                    }

            ed->next=NULL;

            end=ed;

          }

        else                               //inache pamyat' ne ydalos' vudelit'

          {                                //i vuhod iz cikla

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

            wait_key();

            break;

          }

       }

   }

 else                                      //inache net faila  i vuhod

   {

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

    wait_key();

   }

 in_file.close();                          //zakrut' fail

 delete []str;                             //i osvobodit' mesto

}

//dobavit' spisok iz faila v tekyshii spisok

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

{

 educational *ed;

 int count;

 char *str=new char [60];

 ifstream in_file(name_file);

 if(in_file)

   {

    in_file >> count;

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