• Please review our updated Terms and Rules here

Help with a CC40 Program

mutantcamel

Experienced Member
Joined
Dec 14, 2007
Messages
76
I've very new to this programming lark. I'm trying to get part of a program running which is in TI99 Basic and change it so it can work on my CC-40.

The originals lines are:

350 INPUT "How much do you want to bet? ":BET
360 IF (BET>SUM)+(BET<0)THEN 350

After numerous changes I came up with for the CC-40 Version

350 LINPUT "How much do you want to bet?";B$:pAUSE 2
360 IF B$=0 THEN 350
361 IF B$>SUM THEN 350

SUM is defined earlier in line 170

170 SUM=100

I'm assuming for the CC-40 to save the value, it has to be a word or letter containing $. Not sure if you would use LINPUT in this situation, INPUT doesn't seem to work.

When running the program I get the error String-number mismatch

Please help I'm stuck!
 
Hmm...I don't know about this particular version of BASIC but it looks like you're trying to assign a value to a string variable and then doing some boolean logic on it. I think you need an integer variable for this.

Try

350 PRINT "How much do you want to bet?";
355 INPUT B:pAUSE 2
360 IF B=0 THEN 350
361 IF B>SUM THEN 350

SUM is defined earlier in line 170

170 SUM=100

You may or may not need to define B as an interger before that section of code. For some versions of BASIC it's optional (but often a good idea to).

In MBASIC it's
DEFINT B

(I think. It's been a long time since I've touched BASIC)
 
Back
Top