Sunday 11 March 2012

The keys to creating graphically oriented programs in QBASIC

A lot of people ask me how I'm able to create wonderful graphics with
QBASIC, I aim to answer this question in detail as much as I can.

1. You need to have a good knowledge of the QBASIC keywords and their
syntax. QBASIC has a very extensive help file, do try to look into it
from time to time to have a very strong knowledge of the keywords.

2. Have a good understanding of loops as they'll be used to manipulate
variables to create the needed effects on the screen. These loops are:
FOR-TO-NEXT, IF-THEN-ELSE, DO-WHILE-LOOP, DO-UNTIL-LOOP, WHILE-WEND.

3. Understand the screen type you're using, I use screen 12 (640x480)
most of the time. Know the particular colors that work in that screen
type.

4. A graph sheet is indispensable, as it gives you an idea of what
your program will look like when it's ran. Try to give it a scale such
that it matches your screen type (remember that the y axis in QBASIC
increases from top down).

5. One thing you really need to know is this, graphics involve
numbers, manipulate this numbers well and you'll do wonders in QBASIC.
Making use of formulae, loops, increments.

I hope that you understand all this and have a great time programming
in QBASIC. Should I have more tips, they'll be posted quickly, you can
use the comments box below.

QBASIC Program To produce prime numbers

CLS
OPEN "Prime.txt" FOR OUTPUT AS #1
INPUT "UP TO WHICH NUMBER DO YOU
NEED"; N
DIM a(N)
a(1)=0 For i =2 To N/2 step 1 a(i)=1 For j=2 To N/i step 1
a(i*j)=0
Next j
Next i
For i =1 To N step 1
if a(i)=1 Then Print #1, i;"is prime"
Print '(empty if sent to notepad, Your
result is in the notepad,
check for PRIME.txt)
Next i
END