1
votes

i did this and its working slightly better, now i get the error: 45 / 44 matric.pas Fatal: Syntax error, ) expected but const char found It is probable because i am using pascal graph.

program MatrixArray;
Uses wincrt,graph;
Var
GraphicsDriver, GraphicsMode: Smallint;
Xaxis: array[1..10] of string;
Yaxis: array[1..10] of string;
Matrix: array[1..10,1..10] of string;
x:integer;
y:integer;
{two var's are needed for initialisation}
Begin
Writeln('Loading Game Graphics...');
GraphicsDriver := Detect;
InitGraph(GraphicsDriver, GraphicsMode,'');
ClearViewPort;

declaring the arrays

Xaxis[1] :='A';
Xaxis[1] :='B';
Xaxis[1] :='C';
Xaxis[1] :='D';
Xaxis[1] :='E';
Xaxis[1] :='F';
Xaxis[1] :='G';
Xaxis[1] :='H';
Xaxis[1] :='I';
Xaxis[1] :='J';

Yaxis[1] :='1';
Yaxis[1] :='2';
Yaxis[1] :='3';
Yaxis[1] :='4';
Yaxis[1] :='6';
Yaxis[1] :='7';
Yaxis[1] :='8';
Yaxis[1] :='9';
Yaxis[1] :='10';

for x := 1 to 10 do
 for y := 1 to 10 do
     Matrix[x,y] := Xaxis[x] + Yaxis[y];

     For x := 1 to 10 do
         for y := 1 to 10 do

outtextxy is like writeln(); http://pascal-programming.info/lesson8.php

             OutTextXY(0,0, Matrix[x,y]' ');

End.
1
replaced OutTextYX(0,0, Matrix[x,y]' '); - Arran
with OutText(Matrix[x,y]); it worked - Arran
You probably mean Xaxis[2] :='B';, Xaxis[3] :='C';, etc. ;-) - NGLN

1 Answers

1
votes

The OutTextXY routine probably expects two integers and one string as input. The Matrix array holds strings, so use:

OutTextXY(0, 0, Matrix[x, y]);

(Note the missing ' '.)