Quick Basic

ElectricSheepElectricSheep Join Date: 2003-04-21 Member: 15716Members
<div class="IPBDescription">I did this at Camp</div> Whats wrong with this please help me.

Comments

  • FlatlineUTDFlatlineUTD Join Date: 2002-11-08 Member: 7695Members
    You shoulda gone to a Java camp.
  • p4Samwisep4Samwise Join Date: 2002-12-15 Member: 10831Members
    Um....

    I assumed it was a BASIC program and opened it in Notepad, but it looks like binary gobbledegook. If you're looking for programming help, try posting the source.
  • voogruvoogru Naturally Modified (ex. NS programmer) Join Date: 2002-10-31 Member: 1827Members, Retired Developer, NS1 Playtester, Contributor, Constellation
    He's one of the "elite" programmers that programs in binary you nubs!
  • FlatlineUTDFlatlineUTD Join Date: 2002-11-08 Member: 7695Members
    <!--QuoteBegin--voogru+Sep 4 2003, 08:52 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (voogru @ Sep 4 2003, 08:52 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> He's one of the "elite" programmers that programs in binary you nubs! <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    Yes, you're exactly right. That's why he's at camp and all. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    edited September 2003
    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->You shoulda gone to a Java camp.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Sif Java! C++!!! <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->

    ...

    I've got Qbasic, so I can open is. Mwahahaha. Ok, fine I'll post it:
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->PRINT "INPUT FIRST NUMBER"
    INPUT a
    PRINT "INPUT SECOND NUMBER"
    INPUT b
    PRINT "WHAT OPERATION?"

    INPUT g$
    IF g$ = "X" OR "x" OR "times" OR "TIMES" THEN
    ? ? ? ?PRINT a * b
    IF g$ = "/" OR "devide" OR "DEVIDE" THEN
    ? ? ? ?PRINT a / b
    IF g$ = "+" OR "add" OR "ADD" OR "plus" OR "PLUS" THEN
    ? ? ? ?PRINT a + b
    IF g$ = "-" OR "minus" OR "MINUS" THEN
    ? ? ? ?PRINT a - b
    ELSE
    ? ? ? ?PRINT "PLEASE REPRINT THE OPERATION"

    END
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    In QBasic, the structure of an IF statement is like this:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->IF condition THEN
    ? some stuff
    END IF

    or

    IF condition THEN
    ?some stuff
    ELSE
    ?stuff to do otherwise
    END IF
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    You don't have any END IFs! Your IFs are nesting one inside another, with no END IF to close them off! Anyway, you should use a CASE statement for this sort of thing, not multiple IFs.

    Just to nitpick: the PRINT statement's message doesn't have to be in caps. And it's spelled "divide" <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->.
  • p4Samwisep4Samwise Join Date: 2002-12-15 Member: 10831Members
    Last time I used QBASIC it was well-behaved. But that was back in the DOS days. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->

    He's probably using Visual Basic, which is an abomination against all that is holy in this world and the next.
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    <!--QuoteBegin--[p4]Samwise+Sep 5 2003, 10:09 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> ([p4]Samwise @ Sep 5 2003, 10:09 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Last time I used QBASIC it was well-behaved. But that was back in the DOS days. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->

    He's probably using Visual Basic, which is an abomination against all that is holy in this world and the next. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    No, it's most definately qbasic <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
  • WheeeeWheeee Join Date: 2003-02-18 Member: 13713Members, Reinforced - Shadow
    it's most definitely basic...at least he didn't put in line numbers (which were annoying as hell)
  • TransmissionTransmission Join Date: 2003-03-12 Member: 14456Members
    edited September 2003
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    PRINT "Input the first number."
    INPUT VariableA
    PRINT "Input the second number"
    INPUT VariableB
    PRINT "What operation do you want to be used?"

    INPUT g$
    IF g$ = "X" OR "x" OR "multiplication" OR "Multiplication" OR "" THEN
          PRINT VariableA * VariableB
    ELSEIF g$ = "/" OR "division" OR "Division" THEN
          PRINT VariableA / VariableB
    ELSEIF g$ = "+" OR "addition" OR "Addition" OR THEN
          PRINT VariableA + VariableB
    ELSEIF g$ = "-" OR "subtraction" OR "Subtraction" THEN
          PRINT VariableA - VariableB
    ELSE
          PRINT "Error, please reprint the operation."
    ENDIF

    END
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    All better, I think. Although I'm not sure those inputs are correct, I don't remeber though.
  • FinaFina Join Date: 2002-11-01 Member: 3267Members
    Kinda reminds me of my last vacation. I was given an old 80808 laptop. So I used that in the car, made some QBasic programs, played ZZT, Monuments of Mars, and Classic Concentration. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
  • p4Samwisep4Samwise Join Date: 2002-12-15 Member: 10831Members
    Good God, does BASIC really use the same symbols for assignment and equality tests? It's been so long.

    Does this work?
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->g$ = "/" OR "division" OR "Division"<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    I'd have thought you'd need
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->g$ = "/" OR g$ = "division" OR g$ = "Division"<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    but like I said, it's been a while. I used BASIC all through grade school and part of high school, but after learning C (and C++) in college I never looked back. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
  • ZigZig ...I am Captain Planet&#33; Join Date: 2002-10-23 Member: 1576Members
    edited September 2003
    LOL

    that's a good quote in yer sig, samwise... XD

    and... yeah, cool programming. my brain just exploded.
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    edited September 2003
    I deliberately didn't simply post the right answer, Transmission. If ElecrticSheep's learning a language, he needs to learn to fix mistakes himself.

    ...

    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Good God, does BASIC really use the same symbols for assignment and equality tests? It's been so long.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Yes, it does. You can't perform assignment inside an equality test. It's so idiot proof I'm surprised they didn't put it in Java <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->

    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->
    Does this work?
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    g$ = "/" OR "division" OR "Division"
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->


    I'd have thought you'd need
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    g$ = "/" OR g$ = "division" OR g$ = "Division"
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
    <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->

    I'm not absolutely sure, but I think QBasic lets you get away with the former.

    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->but like I said, it's been a while. I used BASIC all through grade school and part of high school, but after learning C (and C++) in college I never looked back<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Same here <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->. Well, I learned C++ while in my last year of high school. We're doing Java at uni, and the only C++ we're doing is really c++--. No OO, have to treat it like C, lecturer wanted to teach us C originally but couldn't. Bah. I hate Java <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad.gif' border='0' style='vertical-align:middle' alt='sad.gif'><!--endemo-->.
  • BeastBeast Armonkyi Join Date: 2003-04-21 Member: 15731Members, Constellation
    edited September 2003
    I believe the correct syntax for if statements in qbasic is:
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->IF [condition] then [result] Else [somethign else]<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
    I used to make things in qbasic when I was 10. It pwned.
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    <!--QuoteBegin--Beast+Sep 5 2003, 05:04 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Beast @ Sep 5 2003, 05:04 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> I believe the correct syntax for if statements in qubasic is:
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->IF [condition] then [result] Else [somethign else]<!--c2--></td></tr></table><span class='postcolor'><!--ec2--> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    It isn't. Scroll up <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
  • BeastBeast Armonkyi Join Date: 2003-04-21 Member: 15731Members, Constellation
    <!--QuoteBegin--SoulSkorpion+Sep 5 2003, 10:20 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (SoulSkorpion @ Sep 5 2003, 10:20 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin--Beast+Sep 5 2003, 05:04 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Beast @ Sep 5 2003, 05:04 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> I believe the correct syntax for if statements in qubasic is:
    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->IF [condition] then [result] Else [somethign else]<!--c2--></td></tr></table><span class='postcolor'><!--ec2--> <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    It isn't. Scroll up <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo--> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    OK maybe I got the last bit wrong, but the IF and THEN on the same line IS correct. I know this through experience. I've been on computers since I was 6 <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
  • CForresterCForrester P0rk(h0p Join Date: 2002-10-05 Member: 1439Members, Constellation
    Mmm... QBasic.... I never really went beyond creating an address book system. I never finished that, either, because I was having trouble with writing to file. Now I've gone and forgot it all. I might try it again, I guess.
  • ElectricSheepElectricSheep Join Date: 2003-04-21 Member: 15716Members
    <!--QuoteBegin--Transmission+Sep 4 2003, 10:15 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Transmission @ Sep 4 2003, 10:15 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    PRINT "Input the first number."
    INPUT VariableA
    PRINT "Input the second number"
    INPUT VariableB
    PRINT "What operation do you want to be used?"

    INPUT g$
    IF g$ = "X" OR "x" OR "multiplication" OR "Multiplication" OR "" THEN
          PRINT VariableA * VariableB
    ELSEIF g$ = "/" OR "division" OR "Division" THEN
          PRINT VariableA / VariableB
    ELSEIF g$ = "+" OR "addition" OR "Addition" OR THEN
          PRINT VariableA + VariableB
    ELSEIF g$ = "-" OR "subtraction" OR "Subtraction" THEN
          PRINT VariableA - VariableB
    ELSE
          PRINT "Error, please reprint the operation."
    ENDIF

    END
    <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    All better, I think. Although I'm not sure those inputs are correct, I don't remeber though. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    It says type mismatch on scond x on multiplication I think my version doesn't accept or because all IFs work if I use only one statement per if but if I use OR "anythingelse" it says type mismatch.
  • SpookSpook Join Date: 2003-07-29 Member: 18542Members
    edited September 2003
    It's been a while since I used QBasic, but a type mismatch on "x" should be because "x" is not a Boolean expression - it's a string. Making all expressions in the condition Boolean expressions (i.e. g$ = "X" OR g$ = "x") should fix that type mismatch problem.

    <boolean> OR <boolean> => perfectly valid
    <boolean> OR <string> => type mismatch

    "x" => string
    g$ = "x" => boolean

    So make all those OR <string> expressions in to OR <boolean> expressions by comparing the string to g$ <u>every</u> time, and you should be a little better off.
  • TransmissionTransmission Join Date: 2003-03-12 Member: 14456Members
    I checked inputs since I thought I had them wrong, and they are done differently.

    The format

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->INPUT "Bla bla": VariableA<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    will produce:

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->Bla bla? <!--c2--></td></tr></table><span class='postcolor'><!--ec2-->

    Then, whatever is typed after "Bla bla" becomes VariableA. The colon is there so there is a question mark at the end of "Bla bla".

    You also didn't declare your variables, so I suggest you do that as well, or it won't work very well.
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    You don't need to declare variables in Qbasic.
Sign In or Register to comment.