Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by helloworld ( 15 years ago )
type
 tpoint = record
  x,y: integer;
 end;
 ar = array[1..100] of tpoint;

var
 a: ar;
 n: byte;
 i,j:byte;

procedure swap(var a,b: tpoint);
var
 t: tpoint;
begin
 t:=a;
 a:=b;
 b:=t;
end;

begin
 readln(n);
 randomize;
 for i:=1 to n do
 begin
  a[i].x:=random(10);
  a[i].y:=random(10);
  writeln(a[i].x,' ',a[i].y);
 end;
 readln;
 for i:=1 to n do
  for j:=i+1 to n do
  begin
   if a[i].x<a[j].x then
    swap(a[i],a[j])
   else
    if a[i].x=a[j].x then
     if a[i].y<a[j].y then
      swap(a[i],a[j]);
  end;

 for i:=1 to n do
  writeln(a[i].x,' ',a[i].y);

 readln;
end.

 

Revise this Paste

Your Name: Code Language: