Graphics in QBASIC
The elements required to construct a QBASIC program consists of a set of characters, keywords, constants, variables, operators and expressions. A constant is a value that does not change during execution of a program. A variable is the name of a location in the computer memory where a number or a string is stored. The commonly used QBASIC statements are LET, PRINT, INPUT, CLS, END, GOTO, IF...THEN and REM. The statements used for creating graphics on the screen are SCREEN, LINE, CIRCLE etc.
In QBASIC, LET statement is used to assign a value to a variable. PRINT statement is used to display any message or value on the screen. INPUT statement in QBASIC is used to accept the data item from the user. GOTO statement is used to transfer the program control from one statement to another. IF...THEN statement is used for making decisions based on comparisons. The statement tests a particular condition.
QBASIC is used to display graphics by using special graphic statements that allow a variety of graphics to be created. The screen is made up of hundreds of pixels. The number of pixels determines the resolution of the monitor. SCREEN statement is used to set the screen resolution. COLOR statement is used to change the background and foreground colours of the screen. LINE statement is used to draw a straight line between any two points on the screen. CIRCLE statement is used to draw a circle, an ellipse or an arc of a circle. Play statement is used to generate musical notes.