This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Technology & Calculator Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Calculator Tech Support => Technology & Calculator Open Topic
Author Message
Snoopyo


Newbie


Joined: 16 Mar 2004
Posts: 15

Posted: 16 Mar 2004 09:29:55 pm    Post subject:

I wrote a game in QBasic (Dos) a long time ago and I was trying to port it to the calculator. I didn't have trouble with most of it but how would you convert this?

IF C < 10: THEN dName% = " None"
IF C > 9 AND C < 20: THEN dName% = "1st Grade"
IF C > 19 AND C < 30 THEN dName% = "2nd Grade"
IF C > 29 AND C < 40 THEN dName% = "3rd Grade"
IF C > 39 AND C < 50 THEN dName% = "4th Grade"
IF C > 49 AND C < 60 THEN dName% = "5th Grade"
IF C > 59 THEN dName% = " Learned"

I got this far, and I know it's not right...

IF C < 10: THEN Str2 = " None"
IF C > 9: AND C < 20: THEN Str2 = "1st Grade"
IF C > 19: AND C < 30: THEN Str2 = "2nd Grade"
IF C > 29: AND C < 40: THEN Str2 = "3rd Grade"
IF C > 39: AND C < 50: THEN Str2 = "4th Grade"
IF C > 49: AND C < 60: THEN Str2 = "5th Grade"
IF C > 59: THEN Str2 = " Learned"
Back to top
Iambian


Advanced Member


Joined: 13 Mar 2004
Posts: 423

Posted: 16 Mar 2004 09:37:29 pm    Post subject:

Cut out the "THEN". And, place the "AND"s on the same line, not separated with colons.
The Optimized code should read the following (where the string is placed in the Ans variable)

IF C<10:"None"
IF C>9 AND C<20:"1st Grade"
IF C>19 AND C<20:"2nd Grade"
IF C>29 AND C<20:"3rd Grade"
IF C>39 AND C<20:"4th Grade"
IF C>49 AND C<20:"5th Grade"
IF C>59: "Learned"

And then you could have to display:

Disp Ans

Or you could store that answer.

Ans->Str2

----------------------
You only put in the "THEN" statements if your condition spans across more than one command. After the series of commands that you want affected by this, you would put an "END" at the end.


Last edited by Guest on 16 Mar 2004 09:38:14 pm; edited 1 time in total
Back to top
Snoopyo


Newbie


Joined: 16 Mar 2004
Posts: 15

Posted: 16 Mar 2004 09:39:03 pm    Post subject:

Awesome, thanks.
Back to top
Snoopyo


Newbie


Joined: 16 Mar 2004
Posts: 15

Posted: 16 Mar 2004 10:13:26 pm    Post subject:

It's giving me syntax errors with the AND
Back to top
Jedd
1980 Pong World Champion


Elite


Joined: 18 Nov 2003
Posts: 823

Posted: 16 Mar 2004 10:43:17 pm    Post subject:

Make sure you are pressing [2nd][Test][Right] for AND, you can't just type "AND".
Back to top
Snoopyo


Newbie


Joined: 16 Mar 2004
Posts: 15

Posted: 17 Mar 2004 04:37:58 pm    Post subject:

Alright! Thanks everyone, I got it to work.
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement