Quick BASIC

Quick BASIC , Acronyme of Quick B eginner' S has L-purpose S ymbolic I nstruction C ode, is a Environnement of development integrated of Microsoft allowing the edition, debugging, the execution and the compilation of the language BASIC under MS-DOS.

The compiler makes it possible to generate achievable .exe MS-DOS 16 bits using a compiler optimized for the 8088 (except in the last versions where special optimizations 286 can be selected) and of a linker.

There exists a version entitled Professional Development System (PDS) Quick BASIC Extended (QBX), whose numbers of version are equal to or higher than 7.x.

A version reduced, based on version 4.5 of the full version and named QBasic , was provided in its version 1.0 with the system MS-DOS and available on the CD-ROM of Windows 95 and Windows 98. With this version, the source code can be only interpreted, and not compiled in file .exe . Thus, to carry out such a program, the environment QBasic is necessary.

This program does not function on the systems Windows in their version 64 bits, because it is an application DOS 16 bits.

Hello World

CLS PRINT " Hello World"

Short cuts Keyboard

  • Ctrl+Break to stop the execution of the program.

  • F5 to continue the execution of the program starting from the place where it stopped.
  • Shift+F5 to start again the program since the beginning.
  • F1 to reach the page of assistance of the instruction under the cursor.
  • Shift+F1 to reach the synopsis of the assistance.
  • F2 to sail between the main program and the procedures/functions.
  • F8 to carry out the program instruction by instruction
  • F9 to place a stagnation point (the execution stops at this place)
  • ? at the beginning of line is automatically replaced by instruction PRINT

Some functions

  • Print is used to post something on the screen
  • Input is used to post a sentence, with waiting of answer
  • Cls erases the screen
  • Rnd is used to generate a random random number in the interval * Yew marks the condition
  • If is associated with Then which gives the instruction which must occur if the condition is true
  • If several instructions follow then, one uses End yew after the block of expressions
Yew then Else end yew
  • the structure while… wend
i% = 1 'give 1 for value to I While i% <> 50 'to repeat as long as I is different from 50 print" coucou" 'cuckoo puts on the screen i% = i% + 1 'increase by 1 the value of I wend 'finishes the loop
  • for structure… next
For i% = 1 To 4 'gives to I all the whole values from 1 to 4 Yew i% = 1 then print " coucou" 'cuckoo posts Yew i% = 2 then print " hello" yew i% = 3 then print " guten tag" yew i% = 4 then print " buenos dias" Next i% 'finishes the loop
  • the structure C… loop
C 'beginning of the loop fine loop 'of the loop corresponds to the script which you want to repeat with while: a% = 1 'give value 1 to the variable " a" C while a% < 10 'as long as " a" is smaller than ten… print" All right! " '" posts; all right" with the screen a% = a% + 1 'additions value 1 with " a" loop

with until: a% = 1 C until a% = 10 'until " a" = 10… print" To Be gold not to Be? " '" posts; To Be gold not to Be? " a% = a% + 1 'additions value 1 with " a" loop

the logical operators

  • And (and) is used to combine two conditions
Yew and Then
  • Gold (Or)
if gold then if the first or the second condition is just then

print " bouh! " '… " is posted; bouh! "

Sample program under QBasic

Here a program coded in QBasic as well as comments. The comments will be in italic and the code

will be in fat.

  • Kind of lotto:
INPUT" Enter your name: " , a$ 'one requires the name of the person to store it in the variable " a$" , 'the symbol " $" mean that the answer will be able to comprise figures and/or letters, but that no calculation could be carried out 'on this variable (one calls this type of variable a " chain caractères"). If one wants to make calculations on this variable, 'the " should be replaced; $" by " %" (type of variable " integer" who will thus comprise only figures). INPUT" Choose the amount of your starting fortune: " , b% 'similar that above, put aside 'that one can this time answer only by one digit (" %") n% = INT (rnd*5) + 1 'one draw a random random number ranging between 1 and 5 and one assigns this number to the variable " n". 'The " INT" is used here to make so that the drawn number is an entirety (that avoids the numbers of the " type; 2.54697") INPUT" On which number wish miser (from 1 to 5)? " , c% 'step need for comment INPUT" How much do you want miser? " , d% 'in the same way IF c% = n% THEN 'if the number is the good… CLS '… one erases what it marked there on the window… b%=b%+ (2*d%) '… one adds to fortune the double of the mized sum… PRINT" Cheer, your fortune is from now on of: " b% '… one indicate the current amount of fortune. ELSE 'if the number is not the same one… CLS 'cf above b%=b%-d% '… one withdraw from fortune the mized sum PRINT" Afflicted, you lost. It remains you: " b% 'cf above END IF ', one indicated Here that the structure yew finishes (" IF, THEN, ELSE") PRINT" Goodbye " a$ 'Poster " goodbye + the name entered to the début"

This script is obviously only one outline of the language, one could add other functions to him (as the impossibility of miser more than one has some, like being able to play, not only once, but to play until one has more money… etc).

See too

FreeBASIC, another compiler mainly compatible with the QuickBasic code.

Some Bonds

  • http://www.qbasic.com
  • http://quickbasic.free.fr
  • http://qbworld.free.fr
  • http://qbasic.on.free.fr
  • http://www.cybwarrior.com/articles/?id=6
  • http://www.qbasicnews.com/
  • http://www.ifrance.com/mediqb

Random links:Case of against-escarpe | BMP-1 | Kirsten Verdel | Price World Fantasy of the best collection | Přerov | Règlement