Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 question bout ERROR
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Poland13




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: 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 Confused 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
JayLo




PostPosted: 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")
Tony




PostPosted: 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")
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Poland13




PostPosted: Wed Jan 07, 2004 6:16 pm   Post subject: (No subject)

thanks alot i couldn't figure it out
Poland13




PostPosted: 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
shorthair




PostPosted: Wed Jan 07, 2004 6:28 pm   Post subject: (No subject)

you never actually tell the program to output the cards , thats the problem
Poland13




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: