|
|
@ -3,33 +3,35 @@
|
|
|
|
unit utils;
|
|
|
|
unit utils;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
uses
|
|
|
|
crt,
|
|
|
|
crt,
|
|
|
|
Graph;
|
|
|
|
Graph;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
type
|
|
|
|
person = record
|
|
|
|
person = record
|
|
|
|
pname : String[10];
|
|
|
|
pname: string[10];
|
|
|
|
psurname : String[10];
|
|
|
|
psurname: string[10];
|
|
|
|
number: Integer;
|
|
|
|
number: integer;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function int_to_str(i: Integer): String;
|
|
|
|
function int_to_str(i: integer): string;
|
|
|
|
procedure write_file(fname: String; data: person);
|
|
|
|
procedure write_file(fname: string; data: person);
|
|
|
|
function read_file(fname: String): person;
|
|
|
|
function read_file(fname: string): person;
|
|
|
|
procedure drawrectnums(nums: Array of Integer; size: Integer);
|
|
|
|
procedure drawrectnums(nums: array of integer; size: integer);
|
|
|
|
procedure init_graphics;
|
|
|
|
procedure init_graphics;
|
|
|
|
procedure graphictext(x, y, size: Integer; text: String);
|
|
|
|
procedure graphictext(x, y, size: integer; text: string);
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
function int_to_str(i: Integer): String;
|
|
|
|
function int_to_str(i: integer): string;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
Str(i, int_to_str);
|
|
|
|
Str(i, int_to_str);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure write_file(fname: String; data: person);
|
|
|
|
procedure write_file(fname: string; data: person);
|
|
|
|
var
|
|
|
|
var
|
|
|
|
outfile: File of person;
|
|
|
|
outfile: file of person;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
Assign(outfile, fname);
|
|
|
|
Assign(outfile, fname);
|
|
|
@ -38,9 +40,9 @@ begin
|
|
|
|
Close(outfile);
|
|
|
|
Close(outfile);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function read_file(fname: String): person;
|
|
|
|
function read_file(fname: string): person;
|
|
|
|
var
|
|
|
|
var
|
|
|
|
infile: File of person;
|
|
|
|
infile: file of person;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
Assign(infile, fname);
|
|
|
|
Assign(infile, fname);
|
|
|
|
Reset(infile);
|
|
|
|
Reset(infile);
|
|
|
@ -48,9 +50,9 @@ begin
|
|
|
|
Close(infile);
|
|
|
|
Close(infile);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function format_num(num: Integer) : String;
|
|
|
|
function format_num(num: integer): string;
|
|
|
|
var
|
|
|
|
var
|
|
|
|
tempstr: String;
|
|
|
|
tempstr: string;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
tempstr := int_to_str(num);
|
|
|
|
tempstr := int_to_str(num);
|
|
|
|
if (tempstr = '0') then
|
|
|
|
if (tempstr = '0') then
|
|
|
@ -61,43 +63,43 @@ end;
|
|
|
|
procedure init_graphics;
|
|
|
|
procedure init_graphics;
|
|
|
|
var
|
|
|
|
var
|
|
|
|
gdriver,
|
|
|
|
gdriver,
|
|
|
|
gmode : Integer;
|
|
|
|
gmode: integer;
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
DetectGraph(gdriver, gmode);
|
|
|
|
DetectGraph(gdriver, gmode);
|
|
|
|
InitGraph(gdriver, gmode, '');
|
|
|
|
InitGraph(gdriver, gmode, '');
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure graphictext(x, y, size : Integer; text: String);
|
|
|
|
procedure graphictext(x, y, size: integer; text: string);
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
SetTextStyle(0, 0, round(size/40));
|
|
|
|
SetTextStyle(0, 0, round(size / 40));
|
|
|
|
OutTextXY(x, y, text);
|
|
|
|
OutTextXY(x, y, text);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure drawrectnums(nums: Array of Integer; size: Integer);
|
|
|
|
procedure drawrectnums(nums: array of integer; size: integer);
|
|
|
|
var
|
|
|
|
var
|
|
|
|
xsize,
|
|
|
|
xsize,
|
|
|
|
ysize,
|
|
|
|
ysize,
|
|
|
|
xstart,
|
|
|
|
xstart,
|
|
|
|
ystart: Integer;
|
|
|
|
ystart: integer;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
xsize := GetMaxX;
|
|
|
|
xsize := GetMaxX;
|
|
|
|
ysize := GetMaxY;
|
|
|
|
ysize := GetMaxY;
|
|
|
|
xstart := Round(xsize/2) - round(size/2);
|
|
|
|
xstart := Round(xsize / 2) - round(size / 2);
|
|
|
|
ystart := Round(ysize/2) - round(size/2);
|
|
|
|
ystart := Round(ysize / 2) - round(size / 2);
|
|
|
|
SetTextStyle(0, 0, round(size/40));
|
|
|
|
SetTextStyle(0, 0, round(size / 40));
|
|
|
|
OutTextXY(xstart+size, ystart, format_num(nums[0]));
|
|
|
|
OutTextXY(xstart + size, ystart, format_num(nums[0]));
|
|
|
|
OutTextXY(xstart+size, ystart+size, format_num(nums[1]));
|
|
|
|
OutTextXY(xstart + size, ystart + size, format_num(nums[1]));
|
|
|
|
OutTextXY(xstart, ystart+size, format_num(nums[2]));
|
|
|
|
OutTextXY(xstart, ystart + size, format_num(nums[2]));
|
|
|
|
OutTextXY(xstart, ystart, format_num(nums[3]));
|
|
|
|
OutTextXY(xstart, ystart, format_num(nums[3]));
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure draw_lines(xstart, ystart, size: Integer);
|
|
|
|
procedure draw_lines(xstart, ystart, size: integer);
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
Line(xstart, ystart, xstart+size, ystart);
|
|
|
|
Line(xstart, ystart, xstart + size, ystart);
|
|
|
|
Line(xstart+size, ystart, xstart+size, ystart+size);
|
|
|
|
Line(xstart + size, ystart, xstart + size, ystart + size);
|
|
|
|
Line(xstart+size, ystart+size, xstart, ystart+size);
|
|
|
|
Line(xstart + size, ystart + size, xstart, ystart + size);
|
|
|
|
Line(xstart, ystart+size, xstart, ystart);
|
|
|
|
Line(xstart, ystart + size, xstart, ystart);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|