6.2.2. Possibilities of QBASIC

 Back  Programming  Next

Most language processors, including QBASIC uses constants and variables and their work. According to the type of information that keeps them and constants and variables can be character-text (string - $) or numeric. What is the difference between constants and variables? The difference is in the way of behavior during program execution. Traditionally, the constants are entered at the outset of the program (as PI=3.141592, etc.) and their value during the execution can not be changed, and its variable value changes during program execution, and a default initial value is zero unless otherwise specified. For example, X=X+1 means that the X that is on the left had a value of zero assigns operations to the right, which it increased to 1 so that upon execution of this command, X=1. Of course, in accordance with that PI=PI+1 will not be executed if the PI is declared as a constant. This example shows that the trivial mathematical operations should not be the keyword.

Variable name can be up to 40 characters and at least one. It is not good that the variable name starts with a number and it is not good that contains special characters outside the ASCII alphabet characters (especially graphemes of localities). For this language processor is irrelevant whether small or big letters because they interpreted the same way.

In the following figure shows the minimum and maximum values allowed for working with variables, files, fields, and other relevant factors of programming.

 QBasic - Limits
Figure 6.2.6 The limits of resources to use QBASIC.

Character variables can contain all ASCII characters and then say, and the figure is treated as text. Of course there are commands (keywords) that can convert the text as a digit in a digit number and vice versa. In addition it is possible to get from any signs of its value in ASCII code which will allow, for example, sorting a list of names.

Numeric variables are a special attraction. Can be expressed as a variable with integer (integer) content with 16 bits or 32 bits (one bit is used for the sign), and a variable number with a decimal point, which kept the number 7 or 15 digits (one seat is used to sign) with the multiplication factor based on 10 (E+38 is 1038, and D+308 is 10308). What is the difference between E and D, if both are 10? Pursuant to the above if you supply the appropriate suffix variables are obtained and their various options. X%, X&, X! and X# will behave differently.

The meaning of this is just the speed of program execution. Is not the same to count from 1 to 10 and the count of 1.0000000000000D+000 to 1.0000000000000D+001. So the mathematical operations of counting students will use an integer variable, but in calculating their average weight variable with a decimal point.

 QBasic - Operators
Figure 6.2.7 Symbols and operators of QBASIC.

Mathematical and logical operators do not need to explain. Special characters used for correspondence and comments to monitor screen layout when entering or printing data (content of variables).

Due to the large number of keywords in the program to help support, and are classified according to the way of belonging to one of the specific groups that are sequentially numbered according to Figure 6.2.8.

  • Management of program performance (mainly infrastructure)
  • Define constants and variables (properties and deletion of content)
  • Definition and BASIC procedure calls (as start)
  • Working with input and output devices (screen and printer)
  • Drawing and image input (drawing and painting enclosed figures)
  • Managing files and directories on the disk (open, delete ...)
  • Enrollment and print from files (retrieve not print data)
  • RAM management (delete, read a specific cell ...)
  • Word processing (manipulation with signs in string variables)
  • Mathematical operations (own functions!)
  • Traps (chasing excess, overload ...)

 QBasic - Keywords
Figure 6.2.8 Keywords grouped according to usage.

Figure 6.2.8 represents a list of almost all QBASIC commands. What if the result of a mathematical operation greater than the capacity of the variables? The program will be canceled at execution and language processor will throw out a message like 'overflow', 'division by zero' or something similar. Thus, one should anticipate this situation and orders for flow control to prevent interruption of program execution. What if the digits entered by mistake instead of the letter 'A' for a numeric variable? Again there will be be canceled at execution in the program and an error has occurred. Again, they are in the 'game' supervisory structure.

Thus, about 25% of the code of the entire program code will relate to his mathematical function, about 50% of the code shall apply to prevent the 'nebulous' entries, results and calculations, and the rest of the design forms for data entry and printing on the screen or printer. Of course, the testing phase is inevitable and should then intentionally make any mistakes in the work with the program in order to reach a 'stable and robust results' resistant to all possible to 'imagine' user. Normally the test team that performs with the development of a software product has no contact, which is understandable, because the developer is very difficult to find their own mistakes. When a software product finally reaches the final production test team that performs again with the above has nothing to do. Described is the part that belongs to phase 6 in Chapter 6 on the development of software. Software support will not be created 'overnight' by drink with pizza.


 Content - Home
 Content  Informatics Alphabet
Citing this page:
Radic, Drago. " IT - Informatics Alphabet " Split-Croatia.
{Date of access}. <http://www.informatics.buzdo.com/>.
Copyright © by Drago Radic. All rights reserved. | Disclaimer