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

 while(work!=NULL)

    if(work->proffs -> competition!=s)

                       work=work->next;

    else

      {

        cout <<work;

        work=work->next;

        count ++;

      }

return count;

}

//lineinui poisk po size_pay(nahojdenie pervogo elementa podhodyashego pod yslovie)

educational* line_find_to_size_pay(educational* current, int value)

{

 educational* work=current;

 while(work!=NULL)

    if(work->proffs ->size_pay!=value)

        work=work->next;

    else

        break;

return work;

}

//poisk kol-va elementov po sovpadeniy size_pay

int line_find_to_size_pay_all (educational* begin, int value)

{

 int count=0;

 educational* work=begin;

 while(work!=NULL)

    if(work->proffs ->size_pay!=value)

        work=work->next;

    else

      {

        cout <<work;

        work=work->next;

        count ++;

      }

return count;

}

//ydalenie elementov s zadannim city

int delete_to_city (educational* &begin, educational* &end, char* str)

{

 educational* work=begin;

 int count=0;

 while(work!=NULL)

 {

    work=line_find_to_city (work,str);

    if(work!=NULL)

      {

        delete_element (work, begin);

        count++;

      }

 }

 end=find_to_end(begin);

return count;

}

//ydalenie elementov s zadannoi street

int delete_to_street(educational* &begin, educational* &end, char* str)

{

 educational* work=begin;

 int count=0;

 while(work!=NULL)                         //poka ne konec spiska

 {

    work=line_find_to_street(work,str);  //poisk 1-ogo

    if(work!=NULL)                         //esli naiden

      {

        delete_element (work, begin);

        count++;

      }

 }

 end=find_to_end(begin);                   //naiti novui konec

return count;                              //vernyt' kol-vo ydalennuh

}

//ydalenie elementov s zadannoi name

int delete_to_name (educational* &begin, educational* &end, char* str)

{

 educational* work=begin;

 int count=0;

 while(work!=NULL)

 {

    work=line_find_to_name (work,str);

    if(work!=NULL)

      {

        delete_element (work, begin);

        count++;

      }

 }

 end=find_to_end(begin);

return count;

}

//ydalenie elementov s zadannum competition

int delete_to_competition(educational* &begin, educational* &end, double competition)

{

 educational* work=begin;

 int count=0;

 while(work!=NULL)

 {

    work=line_find_to_competition(work,competition);

    if(work!=NULL)

      {

        delete_element (work, begin);

        count++;

      }

 }

 end=find_to_end(begin);

return count;

}

//ydalenie elementov s zadannoi size_pay

int delete_to_size_pay(educational* &begin, educational* &end, int size_pay)

{

 educational* work=begin;

 int count=0;

 while(work!=NULL)

 {

    work=line_find_to_size_pay(work,size_pay);

    if(work!=NULL)

      {

        delete_element (work, begin);

        count++;

      }

 }

 end=find_to_end(begin);

return count;

}

//vuvod na display

void out_of_display(educational* begin)

{

 clrscr();                                 //ochistit' ekran

 educational* work=begin;

 while(work!=NULL)                         //poka ne konec

 {

  cout << work;                            //vuvodit' na ekran

  work=work->next;

 }

 cout <<endl<< "Total in list "<< count_to_list(begin)<< " elements!"<<endl;

 wait_key();

}

//sohranit' spisok v fail

void save_list (educational *begin, char * name_file)

{

 educational *work=begin;

 int count=count_to_list(begin);           //skol'ko elementov v spiske?

 ofstream out_file(name_file);             //privyazat' fail

 if(out_file)                              //esli syshestvyet to vuvodit' v fail

   {

    out_file << count << endl;

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

       {

        out_file << work->division         << endl;

        out_file << work->direction      << endl;