Friday 28 September 2012

Augmented quote.

"No one jumps 10 steps ahead when climbing a ladder", except of
course, if you're a (QBASIC) programmer. ;)

QBASIC program testing tip.

Wow, been a long time.
I want to share this simple tip about testing QBASIC codes that
require the user to input several numbers or needs several different
random numbers to run.
Let's say the code is to compute the average of the ages of 200 or
more people, (final purpose), you can reduce the number of iterations
to, say 10 if you'll be entering the values by yourself or you can
leave it at 200 and do this:
where you have the statement

INPUT AGE%(I)

for example, you can replace it with

AGE% (I) = RND * 50

for random integer ages ranging 0 to 50. But if the range is from
something like 20 to 50 you'll code it like this:

AGE%(I) = 20 + (RND * 30) '30 = 50 - 20

To your programming success, Ikformula.

On 4/19/12, bartholomew ikechukwu <ikechukwu4god@gmail.com> wrote:
> Check out this QBASIC program to produce a bar chart from inputted data.
>
> CLS
> SCREEN 12
> ' THIS PROGRAM PLOTS A BAR CHART OF 12 BARS
>
> INPUT " CHOOSE THE COLOR OF YOUR BARS,ANY ONE OF BLUE, GREEN, RED AND
> YELLOW"; COL$
>
> SELECT CASE COL$
> CASE "BLUE"
> LET A = 9
> CASE "GREEN"
> LET A = 10
> CASE "RED"
> LET A = 12
> CASE "YELLOW"
> LET A = 14
> CASE "blue"
> LET A = 9
> CASE "green"
> LET A = 10
> CASE "red"
> LET A = 12
> CASE "yellow"
> LET A = 14
>
> END SELECT
> LINE (10, 200)-(10, 400)
> LINE (10, 400)-(600, 400)
>
> FOR X = 35 TO 600 STEP 50
> INPUT "INPUT VERTICAL VALUE <= 200 "; Y
> LINE (X, (400 - Y))-((X + 30), 400), A, BF
> NEXT X
>
> END
>