в общем, бьюсь с сортировкой. Во второй таблице сортировка по коду, код вводит пользователь: C++. Code: #include <iostream.h> #include <conio.h> #include <stdio.h> #include <iomanip.h> #include <string.h> #include <fstream.h> struct eot{ public: //pervaya tablica int id; int code; char thing[10]; }; struct eotc{ int code; //vtoraya tablica sort po code int id; }; struct eott{ char thing[10]; //3 tablica sort po thing int id; }; eot table[10]; //kol-vo max elementov eotc ctable[10]; eott ttable[10]; void input(){ int c,k; char t[10]; cout<<"\nHow many elements: "; cin>>k; for(int i=0;i<=k;i++) { //vvod dannih cout<<"\nEnter code: "; cin>>c; cout<<"\nEnter thing: "; gets(t); table[i].id=i; table[i].code=c; //zdes' zapolnyaetsa pervaya tablica, vse ok. strcpy(table[i].thing,t); if(ctable[0].code==NULL){ //zapolnyem 0 element, vtoroi tablici ctable[i].code=c; ctable[i].id=i; } else{ //zapolnyaem ostal'nie int m; for(int q=i;q>=0;q--){ //nchnem s poslednego m=0; if(c<=ctable[q].code)//esli vvedenii men'she tekushego { cout<<"\n"<<c<<" < "<<ctable[q].code; getch(); ctable[i].code=ctable[q].code; //menyaem ctable[i].id=ctable[q].id; ctable[q].code=c; cout<<"\n"<<q<<" "<<ctable[q].code; //vivodim tecushiy getch(); ctable[q].id=i; break; m=1; } else if(m==0) { ctable[i].code=c; //esli vvedenii ne men'she to prosto dobavlyaem v konec ctable[i].id=i; }} } } for(int q=0;q<=i;q++) { //zdes' tret'ya tablica sortirovka po thing. strcpy(ttable[q].thing,t); ttable[q].id=i; } } void outmain(){ int k=0; cout<<"\n main table\n"; cout<<" _____________________"; do{ cout<<"\n| "<<table[k].id<<"|"<<setw(4)<<table[k].code<<setw(4)<<"|"<<setw(8)<<table[k].thing<< setw(4)<<"|\n"; cout<<"|--+-------+----------|"; k++; } while(table[k].code!=NULL); cout<<"\n ---------------------"; } void out(){ int k=0; cout<<"\n Sort by code.\n"; cout<<" __________"; do{ cout<<"\n| "<<setw(4)<<ctable[k].code<<setw(4)<<" |"<<ctable[k].id<<"|"; k++; cout<<"\n|--------+-|"; } while(ctable[k].code!=NULL); cout<<"\n ----------\n"; int y=0; cout<<"\n Sort by thing.\n"; cout<<" __________"; do{ cout<<"\n| "<<setw(4)<<ttable[y].thing<<setw(4)<<" |"<<ttable[y].id<<"|"; y++; cout<<"\n|--------+-|"; } while(ttable[y].id!=NULL); cout<<"\n ----------\n"; } void main(){ int option; do{ clrscr(); cout<<"\n Menu\n"; cout<<"1. Create table\n"; cout<<"2. Output main table\n"; cout<<"3. Search by code\n"; cout<<"4. Delete by code\n"; cout<<"5. Output tables\n"; cout<<"6. Edit\n"; cout<<"7. Save\n"; cout<<"8. Open\n"; cout<<"0. Exit\n"; cout<<"\nEnter action: "; cin>>option; switch(option){ case 1: input(); break; case 2: outmain(); getch(); break; case 3: break; case 4: break; case 5: out(); getch(); break; case 6: break; } } while(option!=0); } сейчас в программе два списка и таблица третьего. первый просто заполняется, второй при заполнении должен сортироваться. Помогите с сортировкой второго списка пожалуйста.