Jump to content



Photo
- - - - -

Storing strings to variables


  • Please log in to reply
4 replies to this topic

#1 XYZ

XYZ

    Casio Fan

  • Members
  • PipPip
  • 46 posts
  • Location:Auckland, NZ
  • Interests:Lying on the beach on a hot sunny day

  • Calculators:
    Casio AFX2.0+, CFX9850, HP49G, fx-7700GB, TI-85, TI-92, HP20S scientific....

Posted 19 April 2003 - 06:26 AM

Unfortunately the fx's variables can only hold numbers and can't store text
(this would be handy in programs). The only way to do this it seems is to store the string text in one of the f-mem slots (?->fn1 works) but then the only way to recall the actual string/formula, rather than evaluating it, is to go to f-mem and hit recall. Also what really annoyed me was that to assign a string to f-mem in a prog or run mode, you need to use ?->fn and then enter it, you can't just type "String"->fn1 !!

Any suggestions on how to manage string variables???

#2 Pixter

Pixter

    Casio Fan

  • Members
  • PipPip
  • 43 posts
  • Location:The Netherlands
  • Interests:casio, visual basic, lego mindstorms and formula 1.

  • Calculators:
    cfx9850gb plus

Posted 19 April 2003 - 07:27 AM

Do
Getkey->A
Lpwhile A<10   'if no key is pressed, then getkey<10 so it loops until you hit a key
Do
Getkey->B
Lpwhile B<10
Do
Getkey->C
Lpwhile C<10

with this code, it stores numbers in variables, and those numbers refer to characters.

A=76=>locate 1,1,"A"
A=66=>locate 1,1,"B"
A=56=>locate 1,1,"C"
A=46=>locate 1,1,"D"
blablablabla
B=76=>locate 1,2,"A"
B=66=>locate 1,2,"B"
B=56=>locate 1,2,"C"
B=46=>locate 1,2,"D"
blblalblbla
C=76=>locate 1,3,"A"
C=66=>locate 1,3,"B"
C=56=>locate 1,3,"C"
C=46=>locate 1,3,"D"

this code prints the character that refers to the value. Of course this code could be much smarter, but it gives you an idea.

For example, you can put the values in a list or in a matrix.

#3 ross8653

ross8653

    Casio Addict

  • Members
  • PipPipPip
  • 96 posts
  • Location:over the river and through the woods
  • Interests:paintball

  • Calculators:
    9850 fx2.0

Posted 19 April 2003 - 06:23 PM

and remember if your just using this for high scores or something use that compression to fit 7 characters per cell because a getkey is 2 characters 7*2=14 one short of the 15 allowed unless you do the exponet which is not worth it

#4 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 19 April 2003 - 06:44 PM

The best way to do it is lists, I have tried everything to try to get the casio to work with strings and nothing works, the f-mem thing stores strings but cannot do anything else with them except put them into a Y# variable (you can store strings directly into these as well), but form there they are useless unless its something you just want to view later.

I would suggest this for putting keystrokes in a list:
1->C    //counter variable
Do    //start loop
GetKey->G    //assign the value of a keypress to G
While G<>0    //if a button has been pressed, loop.
G->List #[C]     //this second while statement serves to keep the keypress from registering multiple times,
WhileEnd          //you must let up on the key for it to be ready to accept a new one.
Isz C          //increment counter
Dim List #<C=>31->G
Lpwhile G<>31       //end if [EXE] is pressed.

after you finish with your string I suggest you clear the list you used to free up memory.

#5 XYZ

XYZ

    Casio Fan

  • Members
  • PipPip
  • 46 posts
  • Location:Auckland, NZ
  • Interests:Lying on the beach on a hot sunny day

  • Calculators:
    Casio AFX2.0+, CFX9850, HP49G, fx-7700GB, TI-85, TI-92, HP20S scientific....

Posted 20 April 2003 - 05:42 AM

OK thanks guys. If there is one good aspect of the casio's simple programming model and lack of useful features, at least it makes you think :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users