void sort ticket cur ticket cur2 ticket tmp ticket max cur head while

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void sort()
{
ticket *cur;
ticket *cur2;
ticket *tmp;
ticket *max;
cur=head;
while (cur->next) cur=cur->next;//добежали до последнего элемента в списке
while (cur!=head)
{
max=head;
cur2=head->next;
while (cur2)
{
if (strcmp(cur2->ticket_number, max->ticket_number)>0)
{
max=cur2;
}
cur2=cur2->next;
}
tmp=cur;
cur=cur2;
cur2->prev->next=tmp;
cur=cur->prev;
}
}