1
0
lazarus-tutorials/simple_examples/countries.pas

39 lines
772 B
ObjectPascal
Raw Permalink Normal View History

program countries;
{$mode objfpc}{$H+}
uses strutils;
type
2021-09-30 14:35:36 -04:00
TCountry = record
Name: string;
Area: LongInt;
end;
const
2021-09-30 14:35:36 -04:00
Belgium: TCountry = (Name: 'Belgium'; Area: 30513);
Austria: TCountry = (Name: 'Austria'; Area: 83851);
finland: TCountry = (Name: 'Finland'; Area: 337032);
Germany: TCountry = (Name: 'Germany'; Area: 356734);
procedure DisplayInfo(aCountry: TCountry);
var barLength: integer;
begin
2021-09-30 14:35:36 -04:00
with aCountry do
begin
barLength := Area div 30000;
WriteLn(Name:8, Area:7, ' ', DupeString('*', barLength));
end;
end;
begin
2021-09-30 14:35:36 -04:00
WriteLn(' Country Area Relative area');
WriteLn(' ------- ------ -------------');
DisplayInfo(Belgium);
DisplayInfo(Austria);
DisplayInfo(finland);
DisplayInfo(Germany);
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.