QBasic Tutorials - QB64

QBasic is a simple to use and learn computer language. QBasic is free and works on most computers. This tutorial will get you started programming in QBasic.

In Lesson 1, we saw that PRINT was capable of printing text surrounded by quotes. PRINT is capable of doing a bit more. PRINT is capable of printing calculations too.

Within this tutorial, print formatting will be used to show the user what calculations are being used.

The computer can hold data in memory. The programmer must tell the computer what type of data to hold. This is called a data type.

It is very important that the data matches the data type of the variable. If the data does not match the data type then a type mismatch occurs.

This tutorial will cover getting user input.

If statements are used to check conditions in the program.

Select-Case statements work like If statements. The difference is that the Select-Case statement can make the code simpler to read and work with than If statements.

This tutorial will show the While loop.

This tutorial will show the While Loop.

This tutorial will show the For loop.

This tutorial will show how to make a simple calculator program that asks the user for two numbers.

This tutorial shows several pitfalls in making random numbers. It is a good idea to practice making random numbers and random number generators on your own.

We will make the classic game Guess My Number. It is a very boring game to play, by today’s standards, but programing the game can be interesting.

Arrays hold lists of variables of the same data type.

Parallel Arrays are separate arrays that work together.

Multi-Dimensional Arrays are several arrays that are combined into one. Some examples where a 2 dimensional array might be used would be a chess board, grid, and a deck of cards.

This tutorial will modify the code made within Tutorial 17. This tutorial will show a different way of loading data into an array. By using READ and DATA, the code can be more compact and easier to read.

This tutorial will show how to find the highest and lowest number within an array.

Unfortunately, QBasic1.1, QuickBasic 4.5 and QB64 do not have built in Boolean data types. However, here is three techniques showing how to use Boolean logic within QBasic.

By checking the contents of the array, we can prevent duplicate data from entering into the array.

This tutorial will show how to manipulate strings. The program will print strings vertically, upside down vertically, and in pieces.

This tutorial will show how find if a word or string is a palindrome. A palindrome is a word or string that is the same printed forwards and backward.

Sometimes we need to separate parts of the string. This program will checks each character in the string and separates the characters into letters, numbers and other characters.

There are a few ways of making sounds and music in QBasic. This tutorial will show you how to make songs.

Screen 13 will be used within this tutorial. Screen 13 has a resolution of 320 x 200

There are several screen that are used within QBasic 1.1. QB64 can make custom screens.

This is the introduction to QBasic drawing. SCREEN 13 is used within this tutorial. Line, Box, Box Fill, Paint and Circle will be shown.

SCREEN 13 is used with in this tutorial. This tutorial is a continuation of Drawing Part 1

This is a continuation of Drawing Part 2

This tutorial focuses on drawing with QB64.

This tutorial focuses on drawing with QB64.

This tutorial will show how to move an object (drawn circle) around the screen using keyboard keys.

This tutorial will modify the code used within Tutorial 33.

To use the arrow keys, we need to know the PC Keyboard Scan Codes for keyboard arrow keys.

As programs become more advanced placing all the code in the main program can make the program more difficult to program, maintain, and understand. Slicing the program into sections can help.

This tutorial will show how to make a sub in QB64.

When we made subs in the previous tutorials, we needed to use SHARED when using the same variable within a sub. If we do not wish to make shared variables we can pass the values to the sub.

Functions are very similar to subs with exception that functions return values back to the part of the program that called the function.

Up to this point, all information, used by the programs could not be saved. When the program was closed all information was lost. To keep information saved, in QBasic, text files must be used.

Continuing from Part 1, the next program shows what happens if a file, that does not exist, is opened for input.

Continuing from Part 2, this program will open a text file, that contains questions and quiz the student.

A text file will be created to save preferences for a program.

A text from one text file will be copied into another text file. An identical backup will be made.

A type can hold multiple variables.

This tutorial shows how to use an array with a type.

Because types can hold multiple variables, a type can be used in place of parallel arrays.

This tutorial shows how to insert a picture in QB64.

A picture will move around the screen.

This is a remake of Tutorial 48 to allow an array of balls to bounce around the screen.

Some png images are used to make a simple video game.

LTRIM$, RTRIM$, and STR$ functions are use to remove extra spaces from strings and numbers.

This tutorial shows how to load multiple images into an array using a loop. The images can be easily displayed from the array.

Tutorial 1 - First Program

Tutorial 2 - Printing Math

Tutorial 3 - Print Formatting

Tutorial 4 - Variables And Data Types

Tutorial 5 - Type Mismatch And Other Data Type Errors

Tutorial 6 - User Input

Tutorial 7 - If Statements

Tutorial 8 - Select Case Statements

Tutorial 9 - While Loop

Tutorial 10 - Do Loop

Tutorial 11 - For Loop

Tutorial 12 - Simple Calculator Input Validation

Tutorial 13 - Random Numbers

Tutorial 14 - Guess My Number Game

Tutorial 15 - Arrays

Tutorial 16 - Parallel Arrays

Tutorial 17 - 2D Array - Matrix

Tutorial 18 - Matrix Read Data

Tutorial 19 - Highest And Lowest Array Element

Tutorial 20 - Boolean Techniques

Tutorial 21 - Preventing Duplicate Data In The Same Array

Tutorial 22 - String Manipulation

Tutorial 23 - Palindrome Program

Tutorial 24 - ASCII Program - Separating Letters, Numbers, And Other Characters

Tutorial 25 - Sound And Music

Tutorial 26 - Screen Coordinates

Tutorial 27 - Screens

Tutorial 28 - Drawing Part 1

Tutorial 29 - Drawing Part 2

Tutorial 30 - Drawing Part 3

Tutorial 31 - QB64 Drawing 1

Tutorial 32 - QB64 Drawing Part 2

Tutorial 33 - Moving An Object With The Keyboard

Tutorial 34 - Moving An Object With Arrow  Keys

Tutorial 35 - Making A Sub In QBasic 1.1

Tutorial 36 - Making A Sub In QB64

Tutorial 37 - Passing Values To Subs

Tutorial 38 - Making A Function

Tutorial 39 - Text Files Part 1

Tutorial 40 - Text Files Part 2 - Checking If The File Exists

Tutorial 41 - Text Files Part 3 - QBasic Quiz Questions Program- QB64

Tutorial 42 - Text Files Part 4 - Saving Preferences

Tutorial 43 - Text Files Part 5 - Copy Text Files

Tutorial 44 - Type Example

Tutorial 45 - Type Array

Tutorial 46 - Weather Type

Tutorial 47 - Inserting A Picture

Tutorial 48 - Bouncing Ball Animation

Tutorial 49 - Bouncing Balls Animation

Tutorial 50 - EZInvaders Video Game

Tutorial 51 - Removing Spaces From Numbers And Strings

Tutorial 52 - Loading Multiple Images Into An Array