Yahoo India Web Search

Search results

  1. Mar 26, 2001 · Learn the basic commands of QBasic, such as PRINT, VARIABLES, INPUT and GOTO, with examples and explanations. This tutorial is for beginners who want to create simple programs with QBasic.

    • Your first program
    • PRINT "Hello World!"
    • Deleting the program
    • Commands
    • ?"Hello World!"
    • More about the PRINT command
    • Hello World
    • HelloWorld
    • PRINT (VARSEG(X) * 65536) + VARPTR(X)
    • Strings
    • PRINT X$
    • X = "Hello World!"
    • Retrieving keyboard input from the user
    • PRINT data$
    • INPUT "Enter some text:"; data$
    • PRINT number
    • PRINT text$ PRINT num
    • Strings in IF...THEN
    • Hello
    • Labels and the GOTO and GOSUB commands
    • GOTO
    • GOSUB
    • Loops
    • WHILE...WEND
    • NEXT x
    • Other programming languages
    • C and C++
    • Getting DJGPP
    • QBasic interface
    • Current program
    • Menu
    • Edit
    • View
    • Search
    • Debug
    • Name of current program
    • Immediately execute a command
    • Status of Caps Lock and Num Lock
    • Current line
    • Current column
    • Adding documentation to your programs
    • REM This program clears the output screen, REM and then prints "Some text."
    • LINE (10, 10)-(100, 100)
    • Mathematics functions
    • ABS
    • COS, SIN, TAN, and ATN
    • Date
    • TIMER
    • Subroutines and functions
    • PRINT "Enter some text:"; INPUT text$ PRINT "The text you entered was: "; text$
    • NEXT
    • CALL OutputNumber(16)

    After launching the QBasic interpreter (see before you start), you might see a window requesting a list of "parameters." If this window comes up, press the Enter key to continue. You should now see the QBasic interpreter, which has a blue background and displays a dialog box at the center. (If the interpreter fills the entire screen, then you may w...

    Now press F5 to run the program. You should now see a black screen, with Hello World at the top, and Press any key to continue at the bottom. Press a key on the keyboard to return to the main screen. QBasic interpreter - output screen If you run the program again, the interpreter adds another Hello World. QBasic adds Hello World each time the progr...

    To erase the current program: Go to the "File" menu. Click "New." The interpreter asks if you want to save the program. Select "No" (or if you'd rather keep the program, select "Yes").

    There are also special functions called "commands" (also called "instructions"). A "command" tells the QBasic interpreter to do something. The PRINT command tells the QBasic interpreter to print something to the screen. In this case, the interpreter printed "Hello World!". TIP: Instead of typing PRINT, you can enter a question mark. For example:

    With the PRINT command, you can also print numbers to the screen. Delete the current program (unless you already have) and write the following:

    You can use multiple print statements in your program.

    To place World onto the previous line, place a semi-colon after PRINT "Hello".

    Also, if you put a comma instead of a semi-colon on the first line, the program will insert spaces between the two words.

    (For more information, see Memory.) As in the programs above, a variable is accessed by calling its name. Variable names can have a combination of letters and numbers. The following are valid variables: Y num

    If you add a dollar sign ($) to the end of a variable, the variable is a string. X$ = "Hello World!"

    Output: Hello World! If you try to set a string to a non-string variable, an error occurs.

    The QBasic interpreter says "Type mismatch" when you try to run the above program. A string can be added to the end of an existing variable string. X$ = "Hello" X$ = X$ + "World" PRINT X$ Output:

    One way to receive input from the keyboard is with the INPUT command. The INPUT command allows the user to enter either a string or a number, which is then stored in a variable. INPUT data$

    When this program is executed, the INPUT command displays a question mark, followed by a blinking cursor. And when you enter text, the program stores that text into the variable data$, which is printed to the screen. TIP: If you place a string and a semi-colon between INPUT and the variable, the program will print the string.

    To receive a number, use a non-string variable. INPUT number

    If you enter text instead of a number, the QBasic interpreter displays an error message ("Redo from start"). Below is another example of the INPUT command: PRINT "Enter some text:" INPUT text$ PRINT "Now enter a number:" INPUT num

    TIP: You can have the question mark displayed on the previous line by using a semi-colon. PRINT "Enter some text:"; INPUT text$ ✪

    So far in this chapter, we've only been dealing with numbers, but you can also use strings with the IF...THEN command. x$ = "Hello"

    You can also compare two variable strings: x$ = "Hello" y$ = "World"

    The GOTO and GOSUB commands enables you to jump to certain positions in your program. Labels are used to specify what point in the program to continue execution.

    To use GOTO, place a label somewhere in your program, and then enter.

    The GOSUB command is the same as GOTO, except when it encounters a RETURN statement, the program "returns" back to the GOSUB command. In other words, RETURN continues program execution immediately after the previous GOSUB statement.

    "Loops" make it easier to do an action multiple times. There are at least four types of loops: IF...GOTO, WHILE...WEND, DO...LOOP, and FOR...NEXT.

    The WHILE...WEND commands continue a loop until a specified expression is false.

    Output: (NOTE: This command only works with the DO...LOOP and FOR...NEXT commands, not with WHILE...WEND or IF...GOTO.)

    Information about the below programming languages can be found at ProgrammingTutorials.com.

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    ' Notice the parentheses around the parameter "num." ' Any variables placed inside the parentheses are set as ' the subroutine's parameters. SUB OutputNumber (num) PRINT num

    • 313KB
    • 57
  2. Welcome to our QBasic programming tutorial for beginners! In this video, we'll guide you through the basics of QBasic programming, making it easy for you to ...

  3. Created on 26.03.01. Beginners. Chapter III. How QBasic decides what to do. From the previous chapters you have learned how to create a simple program with INPUT, GOTO and PRINT commands. In such a program, you are asked to type the information, QBasic processes it and then shows the result on the screen.

  4. Mar 26, 2001 · QBasic Tutorial - Chapter 2 - Mathematical Calculations: QBasic will do it all for you, you just need to know how to tell QBasic to do that.

  5. Learn QBasic / QuickBasic techniques from 700+ tutorials on various topics, from beginner to advanced. Find answers to your questions and submit your own tutorials to this archive.

  6. Aug 28, 2020 · Microsoft QuickBasic and QBasic (Quick Beginners All-purpose Symbolic Instruction Code) are very popular programming languages for beginners. While its lack of power makes it unsuitable for many of today's applications, it is an invaluable learning tool.