QBasic

11 Jul, 2022
The name QBasic is an acronym for Quick Beginners All Purpose Symbolic Instruction Code. It was developed and launched by Microsoft in the year 1991 and is considered to be one of the most ideal languages for absolute beginners. It was intended as a replacement for GW-BASIC. QBasic was based on earlier QuickBASIC 4.5 compiler. It does not produce .exe files but instead generates files with extension .bas which can only be executed immediately by the built in QBasic interpreter. It is based on DOS operating systems but is also executable on windows.
Beginning with QBasic:QBasic is available as an open source software.
QBasic consists of two windows:
Program Window: The window titled as ‘Untitled’ is the program window. It is the place where program/code is written
Immediate Window: The window below Program Window titled as ‘Immediate’ is the immediate window. This window is used as a debugging tool and is used when the user wants to check the output of a single statement.
Some Basic useful commands on QBasic:1. PRINT: This command prints the statement or data written after it. If the data to be printed is a string then it is written inside double quotes (” “) and if it is a number or a variable it can be written directly.
Example:
PRINT "HELLO GEEKS"
PRINT age
2. INPUT: INPUT command is used to take inputs/data from the user. It can be used to input both strings and numbers.If the data to be taken is a numerical value then the variable name in which it is to be stored is written directly after the INPUT command.
Syntax:
INPUT "[message to user]"; [variable_name] 
Example:
INPUT age
If the data to be taken is string then the variable name in which it is to be stored is written followed by $ after the INPUT command.
INPUT name$
3. CLS: CLS stands for Clear Screen and is used to clear the screen if some previous results/outputs are present on the screen.
Below is a simple program to illustrate above commands:
Output:
Explanation:When using INPUT commands, users are presented with the message associated with it and are asked to input values to variables.PRINT statement prints the statements associated with it.
Applications of Qbasic:
QBasic is the most suitable language for the beginners to start with. It introduces people to programming without any need to worry about the internal working of the computer.
QBasic is very easy and simple to apply and create business applications, for creating games and even simple databases. It offers commands like SET, CIRCLE, LINE, etc which allow the programmer to draw using Qbasic. Hence, graphics can also be created using QBasic.
QBasic also supports creating sounds of some desired frequency through the speakers of your PC. Though only one sound can be played at once.
Advantages of QBasic:
The key feature of the language is its close resemblance to English.
Syntax of your code is checked automatically.
Qbasic has a dynamic program debugging feature.
Lengthy programs can be broken into smaller modules
Disadvantages of QBasic:
The language is not structured.
Qbasic is DOS based and has now become obsolete and is limited only in the field of education and programming.
Misc
Misc
Misc
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.