I was making a program that displays a matrix style ( lots of 0s, and 1s). When I run the program, i get an error: DATA TYPE
Code:
While K!=45
getKey->K
randInt(0,1,15)->L1
For(A,1,dim(L1
Ans+sub("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ",1+L1(A),1
End
sub(Ans,2,length(Ans)-1->Str1
Disp Str1
End
That's because Ans in
Code: Ans+sub("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ",1+L1(A),1
is a integer (or list), it needs to be a string for that to work.
Could I use toString instead of all of this?
Code:
While K!=45
getKey->K
randInt(0,1,15)->L1
For(A,1,dim(L1
Ans+sub("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ",1+L1(A),1
End
sub(Ans,2,length(Ans)-1->Str1
Disp Str1
End
The code you posted is a bit weird. L1 only contains values from 0-1, so I don't see why you would want to have 37 characters in the string. If you want to have a string with 15 random 1s and 0s, you could do this:
Code: While K!=45
toString(randInt(0,1
For(A,1,14
Ans+toString(randInt(0,1
End
Disp Ans
End
As TheLastMillennial pointed out, Ans has to be a string.
I was in a hurry at school, so I just copied the list to string from ti basic wiki, just to see if would work. That is why it looks weird.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum