question bout ERROR
Author |
Message |
Poland13
|
Posted: Wed Jan 07, 2004 6:10 pm Post subject: question bout ERROR |
|
|
var cardz : array 1..13 of string:= init("2,3,4,5,6,7,8,9,T,J,Q,K,A")
the error is 2 few inital values |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Thuged_Out_G
|
Posted: Wed Jan 07, 2004 6:14 pm Post subject: (No subject) |
|
|
try changing it to 1..12 instead of 1..13...that might help, but im not positive lol
EDIT: ignore my post, ive never used an array that way, so i was not sure....ive only used for loops to put info into my arrays ![Confused Confused](images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
JayLo
|
Posted: Wed Jan 07, 2004 6:15 pm Post subject: (No subject) |
|
|
it's because you have to put each individual string item in quotes, divided by commas.
code: | var cardz : array 1..13 of string:= init("2","3","4","5","6","7","8","9","T","J","Q","K","A") |
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed Jan 07, 2004 6:15 pm Post subject: (No subject) |
|
|
eh... no... you initialize cardz(1) to be that entire string. You need to use separate values... meaning
[code]
init("1","2"...."A") |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Poland13
|
Posted: Wed Jan 07, 2004 6:16 pm Post subject: (No subject) |
|
|
thanks alot i couldn't figure it out |
|
|
|
|
![](images/spacer.gif) |
Poland13
|
Posted: Wed Jan 07, 2004 6:24 pm Post subject: (No subject) |
|
|
can someone help me out bit with this code its suppose to egnerate a random deck of cards ne help would be appreacated
var deck: array 1..52 of string
var cardz: array 1..13 of string:= init("2","3","4","5","6","7","8","9","T","J","Q","K","A")
var suit : array 1..4 of string := init("C","D","S","H")
for x: 1..4
for y: 1..13
deck(cardz):=cardz(1)+ suit(1)
cardz:=cardz +1
end for
end for |
|
|
|
|
![](images/spacer.gif) |
shorthair
![](http://www.members.shaw.ca/rfolz/domo-kun.jpg)
|
Posted: Wed Jan 07, 2004 6:28 pm Post subject: (No subject) |
|
|
you never actually tell the program to output the cards , thats the problem |
|
|
|
|
![](images/spacer.gif) |
Poland13
|
Posted: Wed Jan 07, 2004 6:34 pm Post subject: (No subject) |
|
|
deck(cardz):=cardz(1)+ suit(1)
this is an error subscript of deck is wrong type |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|