Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The process of finding the basic language
The process of finding the basic language
First, the basic language introduction

1. What is the basic language?

BASIC is the abbreviation of general symbol instruction code for beginners. It is the meaning of beginner's general symbol instruction code. It is an international advanced computer language. It is generally considered to be simplified from FORTRAN \u\u\u refining. Therefore, it is easy to learn, and it is not difficult to learn other advanced languages.

Let's go

2. Version of 2.Basic language

Computer languages generally have version sequences. BASIC \language has also experienced continuous development and improvement, and formed different versions in different environments. For example, basic, basic card, F- basic, H- basic, Q- basic and so on. But on the whole, it's almost the same, the basic things remain the same, and the high version is compatible with the low version. So you need panic and surprise. Let's start with the basics, that is, the basics. If you get started first, interested students can deepen and improve themselves through self-study.

Let's go

3. The characteristics of the basic language

(1) is easy to learn. There are only 17 kinds of basic sentence I * * *, which is in quasi-English or quasi-English, and the expressions and operation symbols are similar to those used in mathematics.

(2) Session function. BASIC is a high-level language with strong dialogue function. When a sentence, an expression or a sentence is wrong, the computer will talk to the man and give a prompt in time. So you can make some changes while doing it. It is very convenient for beginners until they are correct and satisfied.

(3) Environmental characteristics. The operation of BASIC programs can be divided into two types: interpretation type and compilation type. Generally, explanatory environment is used for learning and programming. That is to say, if you want to install the BASIC file under DOS, you will enter the state of the basic interpretation environment (its prompt is OK), and the file extension formed by writing the program is agreed as BAS. This is the so-called BASIC source program. When the source program is debugged repeatedly and runs satisfactorily, it can be compiled into a file with an extension of EXE with the compiler software of BASIC \u and run directly under DOS. For basic startup knowledge, please refer to the fourth section of Chapter 1 of the textbook (18 ~ 26 pages).

4. Basic functions

Generally speaking, BASIC has three basic functions: operation, drawing and music. It is simpler and clearer to do mathematical operations than other languages. A statement can set an expression and output results at the same time. But the processing and computing ability of database is weaker than that of D-BASE. BASIC's graphic function is also very strong, and it is even used to make cartoon movies. However, different versions have different functions and are also limited by hardware configuration conditions. BASIC \u also has a strong musical function. You can compose music, and even make sounds that musical instruments can't make to produce special effects. This is the MIDI production in the field of modern audio and video creation.

Second, the composition of the basic procedures and basic rules

Example: There are 32 students in a class, and their computer scores are as follows: A (5 points) 13 students, B (4 points) 12 students, C (3 points) 5 students and D (2 points) 2 students, so as to get the average score of the whole class.

Let's go

The basic procedure to solve this problem is:

10 let A= 13.

20 let B= 12

30 let C=5.

40 let D=2.

50 let u = a+b+c+d.

60 let g = (5 * a+4 * b+3 * c+2 * d)/u.

70 print g

End of 80

From the above example, we can know the structure and rules of the BASIC program.

1. A program consists of several lines, each line writes a statement, and the program is executed in line number order. Generally, the line number is a positive integer, and the remainder is inserted when modifying.

2. A statement is generally divided into three parts, namely, line number (or line label), statement definer, statement body (or expression), and its order and format cannot be wrong.

3. Every program usually ends with an ending. Run enter and run the program; New entry and removal procedures; LIST enter, list programs, etc., as well as the tips on the bottom line of the screen. These are all commands in the BASIC language, which end with enter and produce corresponding effects immediately.

3. Basic statement

1. Print Report (Print Report)

Usage: (1) Print out the value of a variable or expression.

(2) Print the typed string as it is.

Usage: (1) You can print the values of one or more constants (separated by commas).

(2) the value of a constant expression, but it can't play the role of assignment, such as PRINT X=3+5 is wrong.

(3) If the expression contains variables, you must assign values to the variables first, otherwise it will be zero or illegal.

(4) You can output strings, which must be separated by double quotes, and double quotes themselves cannot be used as strings.

Output format: multiple items (such as variables, expressions or strings) can be output at the same time, but they need to be separated by commas (standard format output). If the items are separated by semicolons, they are output in a compact way, and if there is nothing after PRINT \u, an empty line is output. Continuous use of printed sentence output, if there is no punctuation after each sentence, it will automatically wrap; If it ends with a semicolon, it does not wrap, and then outputs the value of the next statement. If it ends with a comma, it won't wrap, and then it will be output in standard format.

2. Assignment statement (LET statement)

Usage: Its function is to send the value on the right of the equal sign to the variable on the left of the equal sign. Therefore, it is different from the mathematical equivalent symbol, such as: LETN=N+ 1, which is wrong in mathematics, but it is often used in LET statements of BASIC language.

Usage: (1) You can assign a constant to a variable, for example, let X=3.

(2) You can assign the value of an expression to a variable, such as L=2*3. 14*R, but you can't assign a value to an expression, such as X+Y=2+3, which is wrong.

(3) A LET statement can only assign a value to one variable, and several equations cannot be used together.

(4) Variables can be assigned values, and the latest values refresh the old values.

Four. Representation of Numbers and Variables in BASIC

(A) the representation of constants

1. Usually decimal is used, but commas are not allowed. The effective digits vary from model to model, and are generally above seven digits.

2. Representation of super-large decimal system

Such as 900 million, expressed as 9E+8 or 9e+8; Another example is 0.0000079, which is 7.9E-6. As for the extent to which it will overflow and be regarded as zero, it is related to the model.

Let's go

(2) Representation of variables

1 has two variables. Basic: simple variables and subscript variables. Simple variables can be represented by any one of the 26 English letters, but generally they cannot be written in XY, 3X and other forms, that is, the multiplication sign cannot be omitted.

2. Subscript variable consists of a capital English letter and subscripts in brackets, and the subscripts can only be positive integers or zero. Such as A(3), X(0), etc.

(3) the representation of operators

1. The symbols of addition and subtraction are the same as those of mathematics. The division symbol is indicated by/,and the multiplication symbol is indicated by *, which cannot be omitted.

2. Power is expressed as self-multiplication, while some basic requirements require even multiplication.

3. The square root is expressed by SQR.

4. The more general expressions of power sum roots are exponent and logarithm.

For example, the b power of a is generally written as EXP(B*LOG(A)).

(4) Priority of operation

The priority of 1. operation is generally the same as that of mathematics.

2. The method of breaking brackets is the same, but the brackets in BASIC are all in brackets regardless of size, and can be applied layer by layer.

(5) Basic expression

1. We call a meaningful expression that conforms to the basic rules and connects constants, variables and functions with operation symbols and brackets as expressions.

2. Expressions must be written according to basic specifications. For example, if a symbol occupies a grid and is on the same horizontal line, upper and lower subscripts are not allowed.

Basic language standard menu

┏━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓

┃ standard function ┃ work ┃ note ┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃SIN(X) ┃ sine function ┃ independent variable units are expressed in radians ┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃CON(X) ┃ Cosine function ┃ Independent variable units are expressed in radians ┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃TAN(X) ┃ tangent function ┃ independent variable unit: radian. If you get too close to the argument.

┃ ┃ ┃ /2 is an odd multiple, which may be overflow┃.

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃ ATN (x )┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃

┃ ┃ ┃ ┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃LOG(X) ┃ that is, the value of natural logarithm ln X ┃X should be positive┃.

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃EXP(X) ┃ ┃ ┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃ sqr (x) ┃ the square root of x (positive root) ┃┃

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

The absolute value of ┃ ABS (x) ┃ x ┃.

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃ int (x )┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃.

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃┃┃┃ 1 (when x & gt0) ┃

┃SGN(X) ┃ Symbolic function ┃ SGN(X) = 0 (when X=0) ┃

┃ ┃ ┃-1 (when x

┣━━━━╋━━━━━━━━━━━╋━━━━━━━━━━━━━┫

┃ R&D Center (X) ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃.

┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃

┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ┗ ε ┛ ┛ ┗ ┗ ┗

Verbs (abbreviation of verb) are drawn in BASIC language.

(A) the two formats of the screen

1. In the basic language environment, the screen has two modes: text format and graphic mode. Text mode cannot be used for drawing, and graphic mode is compatible with text mode.

2. Usually, the default format is text mode, and you can also use SCREEN 0 to convert the graphic mode into text mode.

3. Graphics modes usually range from EN 1, EN 2, ... to screen 9 \u, etc. And their resolution has been improved, but it is restricted by different machine configurations and different versions of BASIC \language. You can call the color number when drawing, but it is also limited by the machine and version. For more information, see the basic screen mode table. 4. the general form is: screen m, c, a, v.

M is the screen mode, C is the color group parameter, A is the working page parameter, and V is the display page parameter.

(b) BASIC drawing sentences in several basic languages

1. Draw a circle to declare a circle.

Format: circle (x, y), r, c

(x, y) is the center coordinate, r is the radius of the circle, and c is the color parameter. If the color parameter is omitted, it will be white. Because the horizontal width display ratio of some monitors is not strict 1| 1, it may look like an ellipse without dots.

2. draw some sentences PSET

Format: PSET(X, y), c

(x, y) is the coordinate of the point to be drawn, and c is the color parameter.

3. Draw straight lines and square statements

Format: line (x 1, y 1)-(x2, y2), c, b [BF]

(X 1, Y 1) is the starting coordinate, (X2, Y2) is the ending coordinate, c is the color parameter, omitting parameters b and BF as straight lines, choosing b as a square and BF as a solid square. If a square is drawn when omitting color parameters, commas cannot be omitted, that is, two commas should be used together.

4. Colored filling statement paint

Format: draw (x, y), c, b

(x, y) is the starting coordinate of color filling, that is, the color filling area spreads around from this coordinate until it meets the boundary. C is the color parameter to be filled, and b is the boundary setting parameter.

Basic screen mode table

┏━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┓

┃ Mode ┃ Resolution ┃ Color group ┃ Number of colors in each group ┃.

┣━━━━╋━━━━━━━╋━━━━━━━╋━━━━━━━━┫

%