Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,845 questions

51,766 answers

573 users

How to create an array of records with a point (x, y) and a string in Pascal

1 Answer

0 votes
program PointMapApp;

{$mode objfpc}{$H+}

type
  TPoint = record
    X, Y: Integer;
  end;

  TPointEntry = record
    Point: TPoint;
    LabelText: string;
  end;

const
  PointCount = 3;

var
  Points: array[1..PointCount] of TPointEntry;
  I: Integer;

begin
  // Initialize points and labels
  Points[1].Point.X := 2;
  Points[1].Point.Y := 7;
  Points[1].LabelText := 'A';

  Points[2].Point.X := 3;
  Points[2].Point.Y := 6;
  Points[2].LabelText := 'B';

  Points[3].Point.X := 0;
  Points[3].Point.Y := 0;
  Points[3].LabelText := 'C';

  // Print each point and its label
  for I := 1 to PointCount do
  begin
    WriteLn('x: ', Points[I].Point.X, ', y: ', Points[I].Point.Y, ' => ', Points[I].LabelText);
  end;
end.




(*
run:
  
x: 2, y: 7 => A
x: 3, y: 6 => B
x: 0, y: 0 => C

*)

 



answered Aug 10, 2025 by avibootz
...