From f2d4bc6b7c302dee2d84a3acf84b83b5a98c45fa Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Mon, 20 Feb 2017 10:33:39 +0700 Subject: More parentheses --- others/other/spiral.pas | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'others/other/spiral.pas') diff --git a/others/other/spiral.pas b/others/other/spiral.pas index 3f8fc57..819b9b2 100644 --- a/others/other/spiral.pas +++ b/others/other/spiral.pas @@ -1,4 +1,4 @@ -uses sysutils; +uses strutils, sysutils; const direction: array[0..3, 0..1] of int8 = ((0, 1), (1, 0), (0, -1), (-1, 0)); @@ -21,13 +21,6 @@ function mt(x, y: int16): boolean; mt := true end; -function rjust(i: int32; len: int8): string; - begin - rjust := inttostr(i); - while length(rjust) < len do - rjust := ' ' + rjust - end; - begin assign(f, 'SPIRAL.INP'); reset(f); @@ -63,8 +56,8 @@ begin for x := 0 to m - 1 do begin for y := 0 to n - 2 do - write(f, rjust(a[x][y], d), ' '); - writeln(f, rjust(a[x][n - 1], d)) + write(f, padleft(inttostr(a[x][y]), d), ' '); + writeln(f, padleft(inttostr(a[x][n - 1]), d)) end; close(f) end. -- cgit 1.4.1