INITIALISATION OF PACKED CHARACTER ARRAYS
Packed arrays of characters are initialised by equating the array to a text string enclosed by single quotes, eg,


	type  string = PACKED ARRAY [1..15] of char;
	var   message : string;

	      message := 'Good morning!  ';  {must be fifteen characters long}

MULTIDIMENSIONED ARRAYS
The following statement creates a type definition for an integer array called multi of 10 by 10 elements (100 in all). Remember that arrays are split up into row and columns. The first index is the row, the second index is the column.

	type  multi = ARRAY [1..10, 1..10] of integer;
	begin work : multi;
To print out each of the various elements of work, consider

	  for  row := 1 to 10 do
	    for  column := 1 to 10 do
	        writeln('Multi[',row,',',column,'] is ',multi[row,column];


PROGRAM THIRTEEN
Given the following marks achieved in a programming test, and that the pass mark is the average of all the marks, write a program to list those students who have passed.
 FRED		21	GEORGE		56
 ANNE		52	MARY		89
 ROBERT		71	ALFRED		71
 CECIL		33	MIKE		54
 JENNIFER	41	PAULINE		48

Click here for answer
Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.