|  | 
|  | 
| вернуться в форум | My program is wrong and my friends laught at me :-(( Pls halp...
 var
 i, n: integer;
 id:array of longint;
 ball: array of integer;
 
 procedure qSort(var ar: array of integer; ra:array of longint);
 procedure sort(var ar: array of integer; low, high: integer; ra:array of longint);
 var
 i, j: integer;
 m, wsp: integer;
 b: longint;
 begin
 i := low; j := high; m := ar[(i + j) div 2];
 repeat
 while ar[i] < m do Inc(i);
 while ar[j] > m do Dec(j);
 if i <= j then begin
 wsp := ar[i]; ar[i] := ar[j]; ar[j] := wsp;
 b := ra[i]; ra[i] := ra[j]; ra[j] := b;
 Inc(i); Dec(j);
 end;
 until i > j;
 if low < j then sort(ar, low, j, ra);
 if i < high then sort(ar, i, high, ra);
 end;
 begin
 sort(ar, 0, High(ar), ra);
 end;
 
 begin
 read(n);
 setlength(id,n);
 setlength(ball,n);
 for i := 0 to n-1 do
 read(id[i], ball[i]);
 qSort(ball, id);
 for i := n-1 downto 0 do
 writeln(id[i], ' ', ball[i]);
 end.
 
 What's wron? Halp pleese!
Re: My program is wrong and my friends laught at me :-(( Послано Egor  20 сен 2015 19:00don't use that languageRe: My program is wrong and my friends laught at me :-(( Because that language hasn't got sort functons? Strange advice to the beginnerRe: My program is wrong and my friends laught at me :-(( He's about English | 
 | 
|