Results 1 to 3 of 3

Thread: An Attempted Qbasic tutorial Part I

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

    Post An Attempted Qbasic tutorial Part I

    Well, It seems to me that a alot of the newbs that sign up for AO don't know any programming languages. So i decided i'd attempt to teach them Qbasic. Here goes nothing.


    PART ONE : HISTORY OF BASIC, GETTING QBASIC AND BEGGINGING COMMANDS

    Well, lets start with the BASIC's {rimshot}. BASIC (standing for Beginner's All Purpose Symbolic Instruction Code) is a system developed at Dartmouth College in 1964. It was meant to be a very simple language to learn and also one that would be easy to translate. Furthermore, the designers wished it to be a stepping-stone for students to learn on of the more powerful languages such as FORTRAN or ALGOL.

    Just as a note, you have to have windows to use Qbasic, so *nix and Mac owner, you can still learn basic, just not here. The first thing to do is to get the Qbasic interpreter. Now I was going to write up the complicted procedure of getting it through the Windows OS CD, but I think I’ll just upload the files. Check at da bottom Download those files to C:/Windows/command and them open up an MS-DOS prompt or command prompt if you have XP. Type ‘qbasic’ and a blue screen should come up with a box in front of it that says “Welcome to MS-DOS Qbasic”. Hit escape, and you should be brought through to a blue screen. This is where you Type your program in.

    Ok, the first thing that you do before I start about the commands there’s two that you NEED to know. The first is ‘cls’ . This command clears the screen, and is (almost) always put in the first line of the program. The second need to know command is ‘end’
    This command (go figure) ends the program, and always goes at the end. Even if you have more instructions after ‘end’, the computer stops reading there.

    The first command to get you started is ‘print’. Print prints whatever else is on the line that is inside the quotation marks. An example in use would be:

    CLS
    PRINT “This sentence prints.”
    END

    When you run the program, it prints (without the quotation marks) “This sentence prints.” Simple, eh? Just as a note, there is also another command that does the same thing, only with a few changes. This command is ‘write’. It is used just like print, except that instead of printing without the quotation marks, write prints with the quotation marks. Okay, now that you have your first program, you have to run it. Hit SHIFT + F5 or go to Run -> Start. Well, that’s it for print and write.

    Next, you need to know how to input data in to the program. First, print your question. Then on the next line type ‘INPUT whateveryouwantyourvariablecalled$’. If your variable is just a number, you can get rid of the ‘$’ sign at the end. Heres an example of the use:

    CLS
    PRINT “Hello, how are you today?”
    INPUT howareyou$
    END

    Now, what good is putting data in to your program if you can’t get an output from it? To put your variable in to the printed string you would do

    PRINT “Well, I’m feeling “ + howareyou$ + “ too!”

    So the program will be as follows:

    CLS
    PRINT “Hello, how are you today?”
    INPUT howareyou$
    PRINT “Well, I’m feeling “ + howareyou$ + “ too!”
    END

    Well, that’s all for this time. I have to go do other stuff, but keep checking for parts two through whenever I don’t feel like doing these anymore.
    \"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
    Junior Member
    Join Date
    Nov 2003
    Posts
    3
    its pretty good for a start

  3. #3
    Senior Member
    Join Date
    Sep 2003
    Posts
    500
    A intro to printing programming tutorial and not a "Hello World" function in sight.
    PRINT Good Job!
    You shall no longer take things at second or third hand,
    nor look through the eyes of the dead...You shall listen to all
    sides and filter them for your self.
    -Walt Whitman-

Posting Permissions

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