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

 if(begin!=NULL)                           //esli spisok ne pystoi

    {

      end=find_to_end(begin);              //to nahodim poslednii

      delete_all(end,begin);               //i vse ydalyaem

    }

 int code;

 cout << endl;

 do {

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

      do

        code=wait_key();                   //jdat' poka ne bydet najata Y y N n

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

      if((code==89)||(code==121))          //esli Y ili y

          {

            cout <<"Input data of "<<(count_to_list(begin)+1)<<" element:"<<endl;

            if (begin==NULL)

                begin=input_new(end);     //vvodit' pervui element novogo spiska

            else

                input_new(end);           //vvodit' ostal'nue elementu

          }

    }while((code==89)||(code==121));      //poka najimayt Y ili y

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

 wait_key();

return end;

}

//lineinui poisk  nachinaya s tekyshego(nahojdenie pervogo elementa podhodyashego pod //yslovie)

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

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

{

 educational* work=current;

 while(work!=NULL)

    if(strcmp(work->education -> city,str))

        work=work->next;

    else

        break;

return work;

}

//poisk kol-va elementov po sovpadeniy goroda

int line_find_to_city_all (educational* begin, char* str)

{

 int count=0;

 educational* work=begin;

 while(work!=NULL)

    if(strcmp(work->education -> city,str))

        work=work->next;

    else

      {

        cout <<work;

        work=work->next;

        count ++;

       }

return count;

}

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

educational* line_find_to_street(educational* current, char* str)

{

 educational* work=current; //zapomnit' nachalo dlya poiska

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

    if(strcmp(work->education -> street,str)) //esli ne sovpadayt stroki to dal'she

        work=work->next;

    else

        break; //inache vuhod

return work; //vernyt'

}

//poisk kol-va elementov po sovpadeniy street

int line_find_to_street_all (educational* begin, char* str)

{

 int count=0;

 educational* work=begin;

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

    if(strcmp(work->education -> street,str))

        work=work->next; //esli net sovpadeniya to dal'she

    else

      {

        cout <<work; //inache vuvesti na ekran

        work=work->next;

        count ++;// i podschitat'

       }

return count; //vernut' kol-vo sovpadenii

}

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

educational* line_find_to_name (educational* current, char* str)

{

 educational* work=current;

 while(work!=NULL)

    if(strcmp(work->proffs -> name,str))

        work=work->next;

    else

        break;

return work;

}

//poisk kol-va elementov po sovpadeniy name

int line_find_to_name_all (educational* begin, char* str)

{

 int count=0;

 educational* work=begin;

 while(work!=NULL)

    if(strcmp(work->proffs -> name,str))

        work=work->next;

    else

      {

        cout <<work;

        work=work->next;

        count ++;

       }

return count;

}

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

educational* line_find_to_competition(educational* current, double s)

{

 educational* work=current;

 while(work!=NULL)

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

       work=work->next;

    else

       break;

return work;

}

//poisk kol-va elementov po sovpadeniy competition

int line_find_to_competition_all (educational* begin, double s)

{

 int count=0;

 educational* work=begin;