Hello, I am now learning Multi- Dim Arrays. My $180 text book was misplaced and I have one on its way for much cheaper as a replacement. This means that I am relying on what I find on the internet to teach me about them.
I followed an example, tutorial http://www.youtube.com/watch?v=JNmZvdTKWrQ and wrote this code. But when I compile it I get an error message ("Incompatible types, got "ShortString", expected "Char")
The only thing I did different from the tutorial that I can see was to make my Arrays Chars and not Strings. Strings are a part of Turbo Pascal and we can't use them for our class so I converted it to a Char. Each of my Chars has only 1 symbol.
Any ideas?
Thanks
-Lars
I followed an example, tutorial http://www.youtube.com/watch?v=JNmZvdTKWrQ and wrote this code. But when I compile it I get an error message ("Incompatible types, got "ShortString", expected "Char")
Code:
Program mArray(input,output);
var
suit : array[1..4] of char;
rank : array[1..13] of char;
cards : array[1..4,1..13] of char;
x,y : integer;
begin
suit[1] := 'A';
suit[2] := 'B';
suit[3] := 'C';
suit[4] := 'D';
rank[1] := '1';
rank[2] := '2';
rank[3] := '3';
rank[4] := '4';
rank[5] := '5';
rank[6] := '6';
rank[7] := '7';
rank[8] := '8';
rank[9] := '9';
rank[10] := 'D';
rank[11] := 'A';
rank[12] := 'C';
rank[13] := 'S';
for x := 1 to 4 do
begin
for y := 1 to 13 do
begin
cards[x,y] := suit[x] + rank[y];
end;
end;
end.
The only thing I did different from the tutorial that I can see was to make my Arrays Chars and not Strings. Strings are a part of Turbo Pascal and we can't use them for our class so I converted it to a Char. Each of my Chars has only 1 symbol.
Any ideas?
Thanks
-Lars