Got something to write about? Check out our Article Builder.

View \STRARRAY.PAS

This is the second disk of the PASCAL TUTOR system. It has the

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 7 - Program 1 *)
program Pure_Pascal_Strings;

type Long_String  = array[1..25] of char;
     String10     = array[1..10] of char;
     String12     = array[1..12] of char;

var  First_Name   : String10;
     Initial      : char;
     Last_Name    : String12;
     Full_Name    : Long_String;
     Index        : integer;

begin  (* main program *)
   First_Name := 'John      ';
   Initial := 'Q';
   Last_Name := 'Doe         ';
   Writeln(First_Name,Initial,Last_Name);

   for Index := 1 to 10 do
      Full_Name[Index] := First_Name[Index];
   Full_Name[11] := Initial;
   for Index := 1 to 12 do
      Full_Name[Index + 11] := Last_Name[Index];
   for Index := 24 to 25 do Full_Name[Index] := ' ';
   Writeln(Full_Name);
end(* main program *)

corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.