Pascal Language Secondary edition finishing

Source: Internet
Author: User
Tags case statement goto natural logarithm square root

P1: Command shell option in the main menu file, you can temporarily exit Pascal and enter the DOS prompt state, but Pascal still resides in memory. Enter the command exit to return to Pascal.
P3:edit Menu Undo is the most recent operation, Redo is undo undo action;
f8--Step executes the program, encounters the function, the procedure does not track its interior;
f7--Single Step execution program, encountered function and procedure call, trace to internal;
P4:goto cursor-f4--Run the program to the cursor line;
Program reset-ctrl+f2--resets the programs that are running;
P5:F10 cursor to main menu;
ALT + main menu item highlight letter;
Size/move the active window by shift+ cursor movement key in P6:window
p7:ctrl+y--Delete the line where the cursor is located;
ctrl+qy--Delete the character of the cursor to the end of the line;
Avoid using the F7 key. The F7 key often fails, and it often refuses to enter the sub-program to expand further tracking. At this point, the F4 key can be used instead of the F7 key to complete the work.
Reduce the frequency of F8 key usage. F8 key in the program run error after debugging, there are some random errors, such as the blue bar will disappear, FP inexplicable exit, or even panic.
Use the F4 key as much as possible. The F4 key is relatively stable, but when you encounter a similar if, Case statement, you must see clearly, the program to perform which step.
The difference between P9:free Pascal and Turbo Pascal (slightly);

Input source program--Debug source program--Compile source program---run program--Save Program
The program written by Pascal is called the Pascal source program, it can not be executed directly by the computer, it must be translated into the target program by the compiler. The so-called compilation is to translate the source program into the target program one at a time, not a line translation.

P13: The program header is the beginning of the program, consisting of program name and program parameter table, ending with a semicolon. The program name is the user-defined identifier, the parameter table is usually a file variable name, used for the program to communicate with the outside world data, the most commonly used parameters are input and output, in Free Pascal parameter table can be omitted.
P14: The algorithm is the step and method to solve the actual problem, it is the basis of writing the program.
Flowchart, N--s (box diagram) (Chapin diagram) description algorithm
P15: Basic structure of the program:
(1): Sequential structure
(2): Select structure (branch structure)
(3): cyclic structure (repeating structure)
P16: Syntax Diagram (abbreviated)
P17: basic symbol, keyword (reserved word), identification (Zhi four tones) character "Valid length is 63 characters" {Standard identifier & custom identifier},
P18----P21 numeral (slightly)
P21: Data type:
① simple types: Divided into standard types (integer, real, character, Boolean) and user-defined types (enumerated, sub-bounded).
② constructed type: Includes array type, record type, collection type, file type.
③ pointer types: both simple and constructed types are called static types, and they are defined before the program runs. A pointer type is a dynamic data type that is dynamically generated as needed when the program is run.
In addition, Integer, character, Boolean, enum and sub-bounds are called sequential types, and sequential types of data are ordered. The so-called order type is that their values are not only ordered, but also have sequential numbers.
P22: Adds $ to the number, indicating a 16 binary number, plus% for binary number.
Note: Int64 is not an ordered type. Assigning a variable of a int64 type directly to an integer that exceeds the Longint range is illegal, because the maximum default type that free Pascal uses to store integers during the evaluation of an expression is longint.
Free Pascal explains this to mod: a mod b=a-(a div B) *b;
Note: The symbol for the result of the MoD operation is always the same as the divisor, regardless of the modulo.
P23: The single quote character type is expressed as: ""
ASCII code is a commonly used character encoding. ASCII code is the U.S. Standard Information Interchange code, each encoding corresponds to one character. The ASCII code consists of 8 bits, usually with the right 7 bits representing the character, and the eighth bit for error checking or idle.
P24: The ASCII code of the number 0 is 48, the ASCII code of the English capital Letter A~z is distributed in 65~90, and the ASCII code of the English lowercase letter a~z is distributed in 97~122;
False the ordinal number of 0,true is 1.
A xor b= (a+b) mod 2
P25: Once a variable is indicated, the system allocates memory for it. When using this variable in a program, it is necessary to read and write data in the corresponding memory unit, which is generally called access to the variable.
P26: Character function chr (x), the function value is the ordinal (ASCII code) is the character of X, is the character type.
exponential function exp (x): function value is exponential e^x
Logarithmic function ln (x): The function value is the natural logarithm of x.
∵x^y=e^ylnx
∴x^y=exp (Y*LN (x))
P27: Ordinal function ord (CH): The function value is the ordinal of the CH character in the ASCII table, and the result is an integer type.
UpCase: Small-to-large; lowercase: big-to-small;
Change from integer to character to apply difference
P32: Programming is the process of analyzing problems, designing algorithms, writing programs, and debugging programs.
The so-called structured programming refers to:
① program must be strictly composed of 3 control structures-sequential structure, selection structure and circulation structure, each control structure has only one entrance and one exit, and is a separate block.
② from top to bottom, step by step refinement design steps. That is, the problem is divided into several sub-problems, and then the sub-problem refinement, gradually refinement, until it can be directly programmed with the statement.
③ abstracts data into different data types to accurately describe the data.
In the Pascal language, the statements are divided into two categories: simple statement and construction statement.
Comment Method: 1. {} 2. (*) 3.//
P33: Assignment compatibility
Assigning a value to a variable is actually a deposit access to the variable, and the data is stored in the corresponding memory unit of the variable. The variable in the expression is the fetch access to the variable, that is, the data is fetched from the corresponding memory unit of the variable, and then participates in the expression operation. such as D:=a, the D is a deposit access, to a is fetched access, so the value in variable a does not change.
P37: The fractional portion of the double field width is rounded, but the number in memory is still the original accuracy.
P39:random are random functions that produce random real numbers between 0~1.
Trunc (random*900) +100 This type can produce a random integer between 100~999
The P40:randomize statement, which is the function of making the random function produce a different number each time the program is run. This effect of Randomize is called buried seed.
P62: With regard to the use of semicolons, the Pascal language requires semicolons to be separated from the statements, not elsewhere.
∵ "End" is not a statement that is adjacent to a statement before ∴end without a semicolon. In Pascal 2.40, because of the increase in fault tolerance, end with a semicolon is not wrong. But you should develop a good habit of standardizing programming.
Control variables must not be re-assigned in the loop body
In a p63:for statement, the values of these variables are allowed to be changed in the loop body, but not the original number of loops, when the loop initial value or the end of the loop contains variables. (However, such behaviour should be avoided in order to improve the "legibility" of the procedure)
P65: Instead of replacing the old value with a new value, this method is called iteration (iteration) and x is the iteration variable.
P66: The characteristic of a type loop is to first judge (Boolean expression) and then execute (loop body). Executes repeatedly when the condition is established. The loop body is not executed when the condition is not established at the outset.
P67: "Carriage return" itself is also a character. A "carriage return" counted for two characters. Formula: π/4=1-1/3+1/5-1/7+ ...
P68: Until the type loop is characterized by first executing (the loop body), after the Judgment (Boolean expression). Repeated execution when the condition is not established. Performs at least one cycle body, regardless of whether the condition is true or not.
Note: Repeat/until is a whole, it is a statement (a constructive statement), so there is no semicolon behind the statement before until.
P71: From a strict classification, the Goto statement is not a circular statement, but an unconditional forced jump statement, which is put into the loop structure because it is often used to achieve the loop effect.
Format: Goto label;
Description: Label label 1, label 2 ...
The label only plays a role that indicates the position, it does not change the function of the original statement
The label is an unsigned integer whose range is 1~9999;
The label does not represent the actual number of rows, and the labels may not be in the order of size;
P74: Using iterative method to find√a. The formula for finding the square root is: x_ (n+1) =1/2 (x_n+a/x_n)
P81: A formal parameter in a custom function, because it is not a variable that actually exists, it does not occupy the inner deposit element. An argument is an argument that is used when a function is called. The value of the argument is assigned to the corresponding formal parameter only when the function is called. Visible, the formal parameter is essentially an "alias" of the argument.
P87: When invoking a procedure or function, the actual parameters of the calling statement in the main program are "actually combined" with the formal parameters in the procedure or function description, which we call the parameter passing.
The way parameters are passed depends on the type of formal parameters in the formal parameter list of the procedure or function description. If the formal parameter is specified as a value parameter, then the actual parameter is required to pass the value to the corresponding formal parameter, and if the formal parameter is specified as the variable parameter, then the actual parameter is required to pass the storage address to the corresponding formal parameter.
P89: It is generally possible to use a value parameter in a function, whereas in a procedure a variable parameter should be used if a procedure is required to return a value to the calling program.
P92: In fact, the formal parameters and the whole amount can play the link between the process (or function) and the main program, but in order to the universality of the process (or function), the process (or function) should be used as little as possible in the whole amount. That is, it is better to have the procedure (or function) contact the external program through parameters. This facilitates the readability of the program. It is not a special case to try not to use a non-parametric procedure.
P92--p99 Stay
P108: one-dimensional arrays are the simplest type of arrays. In a one-dimensional array, the elements are arranged in only one direction.
P111: In the memory of the computer, the array elements are stored sequentially. The elements of a one-dimensional array are arranged sequentially in their subscript order.
P112: Introducing the concept of "pointing"
P114: Two-dimensional arrays consist of "Rows" and "columns", and the elements in a two-dimensional array are arranged in rows and columns in two directions.
P124: The two single quotes of the ligatures still represent only one character, and the length of the string is counted only as long as one character, and is still stored as a single quotation mark when it is actually stored. This is written only to differentiate the single quotation marks in the string from the single quotation marks on both sides of the string in the program.
substrings, main strings, standard string procedures and functions;
p127--p137 to understand and remember
P138--p157 enumeration types and sub-bounds types, collections and records;
p158--p175 pointers and linked lists
p176--p191 file
P192--P206 Data structure
p207--p222 Common algorithm (simple algorithm)
P223--P232 Universal Group Preliminary Examination Questions
p233--p242 Appendix
Summary: Read the book (and not too difficult) and master the contents of the book + Find a website to do fifty or sixty questions = = two "Weak province"

Pascal Language Secondary edition finishing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.