Basics
Qbasic runs on a simple text editor. But it can only read a code to run it, thats why I made this help screen. step by step i will show you how to do simple stuff in qbasic
Print "This is lesson 1" Ok
on the promt of qbasic type
print "Hello world"
Then press F5 .....watch the screen , It says Hello world
Ok on with it.But I wnat to print it in a location..put this on the promt.
Locate 10,10:print "Hello world"
Press F5:(I will not say push F5 anymore. when you want to run a program push F5)
You have learnd much my student from the flame, goto lesson 2
Lesson 2:Loops
Can I explain loops or give you a exaple,exaple i What..type this in
for x = 1 to 10
print x
next x
Whan you run the program. it will print 1-10 down . now change the middle line to for x = 5 to 10 then run the program.it will print 5-15 down. now eneter this in
for x = 1 to 10
locate 1,x
print x
next x
it prints not down but sideways. like it should.if locates what X is o ya and prints x.now type this in
for x = 1 to 9
for y = 1 to 9
locate x,y
print x
next y
next x
It printed a table. Ok what more do you want from loops Well one more thing.Type this in
for x = 1 to 10 step 2
print x
next x
Why did it print like 246810 down it skip 2 until it made it to 10.
Im looped from this
Lesson 3:If ,Then and lonly else
What is it.if I wanted you to go outside then You go. Its the same thing type this in
for x = 1 to 5
if x= 7 then print "+"
if x <> 7 then print "-"
next x
Why it printed - and one + after the 6th - and before the 8th - thats the If's falt it changed the 7th - to a + how.way it says if X = 7 then print X and the other if makes it print "-" if X is grater-lesser then 7:ok type this in
print "Hello world"
10
kk$ = inkey$
if kk$ = " " then goto 20
goto 10
20
cls
When you run the program it prints "hello wlrld" then press space it will vanish in a blink of a eye.Man thats a lot to cover for if statments. ok the command GoTo will goto a place you specify in the case of the program it will goto the place 10.the command Cls maks the screen blank black erases evry thing on the screen and starts fresh and finally the inkey$ thing. why the kk$ = inkey$ thing is there is to make key responce 8 times faster. The if kk$( inkey$) = " " then goto 20 is there to scan the key it scans. that key is " "space. otherwords if it was "a" then you would have to push "a".go on now
Lesson 4:input and the end
type this in
10
input "press(y or n)",a$
if a$ = "n" then print "No I do not whant to":goto 20
if a$ = "y" then print "Ya. get it on now, sexy":goto 20
goto 10
20
print "now this is a example"
'this is a rem for you
the input thing lets you type in Y(yes) or n(no) . A$ is where you stored your answer.it it has a print thing built in. O ya the 'This is a rem for you. if you put a ' before you type something it will be ignored by the program and it will skip it tpye anything you want if you put a ' or rem at the begining
Thats all you could learn from me
Mitch and match difrent things and think . some programs take over 1000 lines of code here is a small none example of a program
randomized timer
print "Guess a number 1 thru 100
num = int(rnd * 100) + 1
10
input "->",a
if a < num then print "the number is grater then";a
if a > num then print "the number is less then";a
if a = num then goto 20
goto 10
20
print "you got it"
if you want to know more read the other help files