1. Home
  2. /
  3. Qbasic
  4. /
  5. Graphics and Input

Graphics and Input - Qbasic Typing CST Test

Loading…

Graphics and Input — Qbasic Code

Shows QBasic's graphics capabilities with drawing commands and user interaction.

REM QBasic graphics and user input example
SCREEN 12
CLS

REM Draw colorful borders
COLOR 9
LINE (0, 0)-(639, 479), , B

REM Title text
COLOR 14
LOCATE 2, 30
PRINT "QBasic Graphics Demo"

REM Draw a house
COLOR 12
LINE (200, 200)-(400, 350), , BF  'House body
COLOR 10
LINE (200, 200)-(300, 100)  'Roof left
LINE (300, 100)-(400, 200)  'Roof right
LINE (200, 200)-(400, 200)  'Roof bottom

REM Draw a door
COLOR 6
LINE (280, 260)-(320, 350), , BF

REM Draw windows
COLOR 11
LINE (220, 240)-(260, 280), , BF
LINE (340, 240)-(380, 280), , BF

REM User interaction
COLOR 15
LOCATE 20, 20
PRINT "Enter your name: ";
INPUT name$
LOCATE 22, 20
PRINT "Hello, "; name$; "! Press any key to exit."

REM Wait for keypress
WHILE INKEY$ = "": WEND
END

Qbasic Language Guide

QBasic is a beginner-friendly, procedural programming language and integrated development environment (IDE) developed by Microsoft for DOS systems, widely used in the 1980s and 1990s for teaching programming and creating simple applications.

Primary Use Cases

  • ▸Teaching programming basics
  • ▸Learning procedural programming
  • ▸Creating simple DOS-based utilities
  • ▸Developing text-based games
  • ▸Educational exercises in logic and algorithms

Notable Features

  • ▸Simple, beginner-friendly syntax
  • ▸Interactive IDE with immediate feedback
  • ▸Built-in support for loops, conditionals, and subroutines
  • ▸Basic graphics and sound commands
  • ▸File handling and text-based I/O

Origin & Creator

Created by Microsoft in 1985 as a simplified version of GW-BASIC, maintained until the mid-1990s.

Industrial Note

QBasic was mainly used in education, early DOS-based games, small utilities, and teaching programming fundamentals, with limited industrial application today.

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher