Jump to content



Photo
- - - - -

Concat text and variable


  • Please log in to reply
4 replies to this topic

#1 Jota68

Jota68

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    CFX 9850G

Posted 24 January 2017 - 12:06 PM

Hi to everybody. Maybe this is very simple, but i don't know how to do it.

 

I am doing a program for CFX-9850G.

 

How i can concatenate a text with the value of a variable?. Is very normal this in programming, but here i don't know how to do it.

 

For example:

"VALOR OF A"?-> A

"A=" + A

 

What i need is to do this (in screen):

_______________________________

VALOR DE A?

                                       3

A=3

 

 

 

 

_______________________________

 

I was searching but i don't see anything.

 

thanks



#2 frankmar98

frankmar98

    Casio Freak

  • Moderator
  • PipPipPipPip
  • 127 posts
  • Gender:Male
  • Location:Spain
  • Interests:Science, programming

  • Calculators:
    CFX-9970G
    Graph 90+E (fx-GC50)
    fx-9860G SD
    Classpad 300
    HP Prime
    TI-84+ CE-T
    x2 TI-83+
    TI-81
    fx-4800p, fx-3650PII
    fx-991SPX, fx-991ES PLUS, fx-100W

Posted 24 January 2017 - 05:41 PM

Welcome to UCF, Jota68, you must introduce yourself in this topic:

http://community.cas...ge-7#entry61003

 

This is impossible in CFX-9850 series basic.

 

You can try:

"VALOR DE A"?->A

"A="(output triangle)

A(output triangle)

 

First, print the string, and then print the variable with the triangle in SHIFT -> PRGM menu.



#3 Jota68

Jota68

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    CFX 9850G

Posted 25 January 2017 - 08:53 AM

Thanks frankmar98.

What i supposed.

 

In fx-9750gII is possible in more easy way?



#4 frankmar98

frankmar98

    Casio Freak

  • Moderator
  • PipPipPipPip
  • 127 posts
  • Gender:Male
  • Location:Spain
  • Interests:Science, programming

  • Calculators:
    CFX-9970G
    Graph 90+E (fx-GC50)
    fx-9860G SD
    Classpad 300
    HP Prime
    TI-84+ CE-T
    x2 TI-83+
    TI-81
    fx-4800p, fx-3650PII
    fx-991SPX, fx-991ES PLUS, fx-100W

Posted 25 January 2017 - 09:44 AM

I have been testing the Str commands in my upgraded fx-9750GII, and you can merge a formula and a String, but you can't merge a string with a numeric variable.

 

You can search in the user guide for the Str commands.

 

If you own a CFX-9850G, the fx-9750GII is not a real upgrade, the real upgrade would be an fx-9860G /GII.



#5 3298

3298

    Casio Addict

  • Members
  • PipPipPip
  • 79 posts
  • Gender:Male
  • Location:Germany

  • Calculators:
    fx-9750G Plus
    Algebra FX 2.0 (ROM 1.03,broken)
    HP 50G

Posted 26 January 2017 - 10:40 AM

The older calculators (i.e. everything older than the 9860 series with OS version < 2.00) don't have string variables, that much is correct. However, you can use the Locate command to print text anywhere on the display. With that you can just print the pieces of your string one by one, like this:
"Value of A"?->A
"A="
Locate 3,2,A
I hope I got the coordinates right... I don't have a Casio calc with me, and I haven't used one in a looong time (HP calcs are so awesome once you understand how they work). Anyway, the 3 and 2 specify where the last parameter (A in this case) is printed. The last parameter can be a literal string (in quotes) or anything that evaluates to a number (in that case the number should be printed).

Note that the autoscroll feature of the other text-related commands (text in quotes, ?, the little triangle ... did I miss one?) may screw with your carefully calculated Locate coordinates. What I usually did was filling the display with seven times " " at the start of the program and after any use of ClrText, so any further use of these commands would be guaranteed to scroll the display. Then I'd be able to write to the display with Locate, scroll it with another " ", and use ? and the triangle without them overwriting one of my Locate lines.

Another useful fact: on these old machines text simply put into quotes is printed very slowly (you can watch it appear letter by letter), but Locate with the same text is much faster. The downside is that Locate cannot scroll, and it cannot wrap long lines either. My usual trick was to use " " to scroll the display (just one space, that's fast enough), then Locate 1,7,"My long text here" which immediately overwrites that space I printed.

If you find that 7 lines with 21 characters each is not enough space for your text, you can also use the graphics display instead (it uses a smaller font for text). The command to print text there is named Text; like Locate it can deal with literal strings (with quotes, as usual) and anything resulting in a number, and it takes pixel coordinates (1,1 for top left corner; warning - the parameters are swapped compared to Locate). You can also decorate that text with F-Line and the PlotOn/PlotOff, PxlOn/PxlOff commands, but it's impossible to scroll the graphics display without erasing all text and decorations. Input is also limited as you can use Getkey to read the keyboard directly and react to that yourself, or you can use the Plot command combined with the small triangle to let the user move a cursor (the EXE key turns the pixel at the cursor location on and stores the coordinates to X and Y).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users