Talk:QBasic

QBasic != Quick Basic
 * Yes, but for the purposes of basic coding the syntax is essentially identical. Xerol Oplan 03:02, 17 December 2005 (UTC)

Why no full book view?
Is it just me or there is not a way to see the full book view of QBasic. Why is there no link to see the ull book view of this book? Thank you. My IP address is not permanent. [March 22, 2006 01] Recently registered on Wikipedia as Kushal_one [e-mail removed] just joking the e-mail address is on my talk page (I assume it is.) 202.79.62.14 22:22, 22 March 2006 (UTC)

May I suggest Restructuring
If you don't mind, I'd like to completely restructure this wikibook so it takes a more pleasing form, so people who have no programming experiance could look at this wikibook and know where to go.

One thing I will do, is add a full book view for Kushal_one. Look forward to other stuffs added to this wikibook by me.

Scud43 14:35, 7 May 2006 (UTC)

I will be going through the pages and restructuring them. I may also add images (depending on how I feel. --Grich 01:42, 9 February 2007 (UTC)

The Appendix
I am currently going through all the QBasic commands and putting them into the appendix. Wont be ready for a while and I may need help. --Grich 08:23, 6 February 2007 (UTC)

Just wondering where this could go...
I just did a major overhaul of the QBasic article on Wikipedia. In the proccess, I removed two excessively large example programs from the article, which I thought didn't belong in an encyclopedia, but were more of a tutorial thing. So here they are, I hope someone finds a place for them here:

DO CLS           'This clears the screen. It's the default first line, as it gets rid of               'unwanted text and graphics. By the way, the apostrophe is a comment. 'Everything past it is ignored by QBasic, which is why I can say anything.

PRINT "Press escape to end the insane beeping! Muahaha!" 'PRINT prints text to the screen. 'The quotes tell Qbasic that the stuff 'inside is a string. PRINT can be                                                           'replaced by a question mark "?".

DO WHILE INKEY$ <> CHR$(27) 'Checks to see if the user is pressing "escape"; the 'ASCII value of that key is represented by "CHR$(27)", 'the ASCII value of escape is 27. "DO WHILE" creates a loop, saying "Do this until 'the user whatever comes after the "DO WHILE", in our case presses escape

LET x% = INT(RND * 9000 + 100) '"LET"-This "declares" the variable. It's obsolete, so you could 'just say "x% = whatever". '"RND" generates a smallish random number. Multiplying it by 9000 'makes it a number between 0 and 9000. "+ 100" makes it between 100 'and 9100. "INT" makes it an integer (number without a                                'decimal point) and the "%" tells QBasic it's an integer, rather 'than, say, a string.

SOUND x%, 1   'This makes a sound, with its frequency (pitch) being x Hz. This number has to                'be between 36 and 32767, but ordinary speakers can't produce a frequency anywhere near '32767 Hz, and only girls and a few other humans can easily hear pitches much beyond '14000 or so. The writer of this program may have little hearing much beyond '9100 or so. ", 1" says that the sound will last 1 clock tick. A clock tick in                'QBasic happens 18.2 times a second. So, this program will make some CRAZY beeps.

LOOP          'This ties in with the "DO WHILE" part. Without this, the "DO WHILE" won't know when 'stop and start over.

PRINT "Ok, I'll stop." 'Prints "Ok, I'll stop." SLEEP 2               'Waits two seconds, then continues. Remove the "2" and it will wait for a                       'keypress. Note that different functions use different time units.

INPUT "Beep again? (y/n, then hit enter, n is default)", beep$ 'Checks to see what the user types 'before they hit enter, and stores it in a                                                                'variable ("beep")

LOOP WHILE beep$ = "y" OR beep$ = "Y" 'Tells the program to goto the start, if the users types "y"

The following code illustrates some of the structured programming features of QBasic, such as Sub-routines and functions, and loops, and some of the QBasic graphics capabilities.

' Spiro.bas ' DECLARE SUB MoveTo (x AS DOUBLE, y AS DOUBLE) DECLARE SUB Spiro (ns AS INTEGER, nw AS INTEGER, nt AS INTEGER, d AS INTEGER, spos AS INTEGER, x AS DOUBLE, y AS DOUBLE, col AS INTEGER) DECLARE FUNCTION HighestCommonFactor (a AS INTEGER, b AS INTEGER) ' ' TEST ROUTINE DIM s AS INTEGER ' loop counter DIM col AS INTEGER ' Drawing color DIM r AS INTEGER, spos AS INTEGER, x AS DOUBLE, y AS DOUBLE

SCREEN 9 ' Set screen mode to 640x350, 16 colors x = 320 ' or Max x coordinate / 2 y = 175 ' or Max y coordinate / 2 col = 1 diam = 2	' Diameter of drawing wheel spos = 100	' Starting position FOR b = 1 TO 12 ' Draw 12 spirographs Spiro 360, 120, 360, r, spos, x, y, col r = r + 2		' increase distance from centre of drawing wheel spos = spos + 10	' increase starting position col = col + 1		' next color NEXT END

' Draw the loci of a point on a circle revolving inside ' another circle, or a circle revolving round another circle. ' Parameters: ' ns,  No. teeth in stationary part (-ve = outside) ' nw,  No. teeth in wheel (-ve = clockwise) ' nt,  No. of teeth to 'do' ' r,   Radius ' spos, tooth to start at ' x, y Coordinates of centre ' col    Drawing color SUB Spiro (ns AS INTEGER, nw AS INTEGER, nt AS INTEGER, r AS INTEGER, spos AS INTEGER, x AS DOUBLE, y AS DOUBLE, col AS INTEGER) DIM n1 AS INTEGER, n2 AS INTEGER, i AS INTEGER, n AS INTEGER, no AS INTEGER DIM a AS DOUBLE, b AS DOUBLE, alpha AS DOUBLE, beta AS DOUBLE DIM offang AS DOUBLE, dab AS DOUBLE, adif AS DOUBLE, aob AS DOUBLE DIM x1 AS DOUBLE, y1 AS DOUBLE, x2 AS DOUBLE, y2 AS DOUBLE DIM PI AS DOUBLE

PI = 3.14159265358979324# n1 = ABS(ns): n2 = ABS(nw) a = n1 / (2# * PI): b = n2 / (2# * PI) IF ns < 0 THEN dab = a + b: r = -r ELSE dab = a - b   END IF    offang = (spos - 1) * 2# * PI / n1    alpha = 0#: adif = PI / n1: aob = a / b    n = (n2 / HighestCommonFactor(n1, n2)) no = 2 * n * ABS(nt) x1 = dab + r: y1 = 0# x2 = x1 * COS(offang) + x: y2 = x1 * SIN(offang) + y   MoveTo x2, y2    FOR i = 0 TO no - 1 IF nw < 0 THEN alpha = alpha - adif ELSE alpha = alpha + adif IF ns < 0 THEN beta = -alpha * aob ELSE beta = alpha * aob x1 = dab * COS(alpha) + r * COS(alpha - beta) y1 = dab * SIN(alpha) + r * SIN(alpha - beta) x2 = x1 * COS(offang) - y1 * SIN(offang) + x       y2 = x1 * SIN(offang) + y1 * COS(offang) + y        ' setcolor(col); lineto(x2, y2) LINE -(x2, y2), col NEXT END SUB

' MoveTo x, y ' For QBasic ' For other languages, replace or omit SUB MoveTo (x AS DOUBLE, y AS DOUBLE) DIM dr AS STRING dr = "BM " + STR$(INT(x)) + "," + STR$(INT(y)) DRAW "X" + VARPTR$(dr) END SUB

' Highest common factor - Euclid's algorithm FUNCTION HighestCommonFactor (a AS INTEGER, b AS INTEGER) DIM i AS INTEGER, j AS INTEGER, r AS INTEGER IF a > b THEN i = a: j = b   ELSE i = b: j = a   END IF    r = i \ j    WHILE (r <> 0) i = j: j = r: r = i \ j   WEND HighestCommonFactor = j END FUNCTION I'll try to find a place for it. --Grich (talk) 00:23, 21 May 2008 (UTC)

Hello
Hello guys! I am joining the team for creating this book. I have created the page "Advanced Graphics". Any suggestions will be very helpful. Also, there were a few pages missing in the full book view, I have added them. Next, I have attempted to make the Qbasic home page a bit better. Please also tell if you find any problems. I will also be adding a few things to the "Appendix" and making some new chapters. I have, in my changes set the book completion status to 50%, because , in my opinion , it was already quite completed. Also, if any one in this group is a reviewer, it will be very helpful if you check and review the changes I have made. Thanks in advance. Debanshu.Das (discuss • contribs) 15:15, 4 June 2019 (UTC)

Author names
Hey guys, I am uploading the pdf version of this book, I require all author names. Quickly please! Debanshu.Das (discuss • contribs) 16:50, 5 June 2019 (UTC)

REVIEWING
Well, my edits have been sitting for what seems like an eternity. Please, someone review them!

Advanced Graphics and Qbasic home page. Debanshu.Das (discuss • contribs) 09:36, 7 June 2019 (UTC)


 * I may be able to take a look in a few hours. Don't get too worried about articles not getting reviewed immediately.  It does no harm, makes no huge short-term difference except on Wikijunior where edits aren't visible by default until reviewed. --Pi zero (discuss • contribs) 10:58, 7 June 2019 (UTC)

Author names
Author names please. The authors page is in quite a bad shape. Write the names in this format: Name: Contribution(page)

if anyone has not created any page, but edited them, write Name:Edit(page)

Thanks.

Templates to be used
I have created templates Template:Chaptermark and Template:booksource. Please see if they are good and if i can use them in the book. Debanshu.Das (discuss • contribs) 09:36, 9 June 2019 (UTC)
 * Their docs don't provide any example to judge... JackPotte (discuss • contribs) 10:34, 9 June 2019 (UTC)

Included the examples
Thanks for telling me about that "example-less" mistake. I have made the changes. Please see now. Debanshu.Das (discuss • contribs) 16:43, 9 June 2019 (UTC)
 * OK, it looks pretty good. JackPotte (discuss • contribs) 22:04, 9 June 2019 (UTC)

Thanks
Thanks! I was thinking of using the chaptermark template to give a nice look to the chapters list. What do you guys think?Debanshu.Das (discuss • contribs) 15:40, 10 June 2019 (UTC)