Qbasic Programmers,I need some help.
Qbasic Programmers,I need some help.
After a few weeks of studying QB,I finally have a grasp on QB(IN JUST 2 WEEKS! ).QB is awesome.It allows your dreams to come true with a few or alot of commands with no knowledge at all,just common sense.But anyway,I've been programming in QB today and I came across a problem;the SUB and GOSUB command.Without these two commands,I will have a much harder time making big games and apps.Reply your technique or even reply techniques for game design.Thank you.
Re: Qbasic Programmers,I need some help.
tinman47 wrote:After a few weeks of studying QB,.......with a few or alot of commands with no knowledge at all,...a problem;the SUB and GOSUB command.
Sorry for that.
Get real will ya ? If you even don't understand the SUB nor GOSUB lines, you hardly can state "I finally have a grasp on QB".
Put your lazyness aside and study a bit more. If you ever want to be able to program something : LEARN.
Here's what seems to be a decent tutorial:
http://tedfelix.com/qbasic/
(It includes some info about how subs and functions work)
http://tedfelix.com/qbasic/
(It includes some info about how subs and functions work)
Owner / Webmaster of DOSGames.com for over 20 years
Download my free ebook: The Historical Reliability of the New Testament
Download my free ebook: The Historical Reliability of the New Testament
- Swiftcutter
- Expert
- Posts: 146
- Joined: Thu Jun 23, 2005 7:49 am
A sub (subroutine) is like a mini-program that you can run from the main program. That way, instead of typing the same code over and over at different places in your program, you can just make it a sub and run that.
Here's an example. This program will generate three random numbers between 1 and 10 and print them to the screen.
To keep things organized, Qbasic stores your subs separate from the main program code. Press F2 to access them.
Hope that helps. I'm moderately well-versed in Qbasic, so LMK if you have any more questions. :)
Here's an example. This program will generate three random numbers between 1 and 10 and print them to the screen.
Code: Select all
'This part defines the sub. It must come before anything else in the program
SUB roll10
PRINT (INT(RND*10)+1)
END SUB
'This part is the main program. It runs (or "calls") the "roll10" sub three times.
RANDOMIZE TIMER
CLS
roll10
roll10
roll10
Hope that helps. I'm moderately well-versed in Qbasic, so LMK if you have any more questions. :)
Great,this completely solved my problem!
Thanks...
FOR DESTROYING THE EVIL IN MY SOUL...
Thanks...
FOR DESTROYING THE EVIL IN MY SOUL...
Soundcloud: https://soundcloud.com/metroy