Jump to content



Photo
- - - - -

[basic] Error With Lists And If Statements [solved]


  • Please log in to reply
No replies to this topic

#1 Massey101

Massey101

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    CASIO fx-9860G AU

Posted 17 October 2010 - 08:19 AM

Hello, I am currently porting my perl script to encrypt things based on a hill cypher, onto the calculator in BASIC. I am having a problem with displaying a letter based on the number associated with it (eg: 1=A, 2=B .. 0=Z) stored in a list. The code does a bunch of if statements to see what the number is and display the letter.

[codebox]for 1->O to 4 //its an O not a 0 BTW
list 1[O]->r
r=1=>Locate O,2,"A"
...
r=9=>Locate O,2,"I"
...
r=0=>Locate O,2,"Z"
next[/codebox]

A majority of the numbers work perfectly, however for some reason when displaying the letter I (the number 9) it fails to display anything at all. I have checked many times and there is no syntax differences. The list was originally defined from a matrix and then was re-entered after having some more calculations (mod26)done on it. I have found one inconvenient work-around, if I display the number on the screen and get the user to enter in the number again exactly the same it somehow works. (This is directly before the above code).

[codebox]For 1->O to 4
ClrText
List 1[O]->r
Locate 3,2,r
"RE-ENTER"?->List 1[O]
Next[/codebox]

I am using the fx-9860G AU with Casio OS1. I do understand that with Casio OS2 I can have string variables but I would like my program to be compatible. I will post up the full source code for either the BASIC or the Perl on request if it will help fix this damn problem!

ps. what is the OS actually called?

Edited by Massey101, 18 October 2010 - 02:07 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users