PROGRAMMING IN QBASIC- ESSENTIAL POINTS


  • QuickBasic is a programming language developed by Microsoft for use in the MS-DOS operating system. It is the successor of earlier forms of BASIC (Beginners All-Purpose Symbolic Instruction Code), a simple programming language for beginning programmers.
  • QB is an ideal programming language for beginners because of its intuitive commands, simple structure and flexibility. It is well-documented, and hundreds of tutorials and sample programs are available for download on the Internet.
  • A comment starts with an apostrophe ( ' ). This is the character just left of the Enter key on the computer's keyboard. Comment lines tell humans what the program does, or what parts of the program do. When the program runs, the computer does not look at the comments at all. The comment lines have no effect on what the program does.
  • Commands:
    1. PRINT: It tells Qbasic to write something to the screen.
    2. REM: It stands for remark and is used to add comments to the code.
    3. INPUT: With Input, you can ask the user to enter a value.
    4. IF...THEN...ELSE IF (condition is met) THEN (do this task) ELSE (otherwise do this)
        Conditions:
      • > (greater than) : If the first value is more than the second, the condition IS met otherwise it is NOT
      • >= (greater than OR equal to) if the first value is greater than or equal to the second, the condition IS met otherwise it is NOT
      • < (less than) same as above except if the first value is LESS than the second, the condition IS met otherwise it is NOT
      • <= (less than OR equal to) if the first value is less than the second, the condition IS met otherwise it is NOT
      • =(equal to) (I think this one is pretty obvious)
      • <>(NOT equal to) (again, its quite obvious)
      More Conditions:
      • OR: The OR statement tells QBASIC to do the action after "THEN" if either of the conditions are met.
      • AND: The AND statement tells QBASIC to do the action after "THEN" if ALL of the conditions are met.
      • NOT: The NOT statement tells QBASIC to do the action after "THEN" if a condition is NOT met.
    5. LOOPS: A loop is a sequence of instruction s that is continually repeated until a certain condition is reached.
      • Loops can repeat in two ways:
        • A specific number of times. FOR...NEXT Loops
        • Until a certain condition is met. DO Loops
    6. MODIFYING A STRING
      • LEFT$: This command will take the left part of a string.
      • RIGHT$: This command will take the right part of a string.
      • MID$: With mid$ you can take the middle of a string by specifying where you want to start from and how many letters you want.
      • UCASE$: It tells QBASIC to capitalize each letter in a string.
      • LCASE$: It tells QBASIC to make every letter in a string lower case.
  • MATHEMATICAL OPERTORS:
    1. + : adds two values
    2. - : subtracts the second value from the first
    3. * : (That's an asterisk) multiplies two values
    4. / : divides the first value by the second
    5. ^ : raises the first number by the second number. 3^2 would be 3 raised to 2, or 9
    6. SQR(num) : Takes the square root of a number
    7. (num) MOD (num2) : Gives you the remainder when you divide num by num2

I am in