First, computer knowledge
1, Computer composition and working principle
A computer is a combination of hardware and software. Hardware consists of host box and external equipment, host mainly includes CPU, memory, motherboard, hard disk, optical drive, various expansion cards, cable, power supply, etc., external devices including mouse, keyboard, etc. Software includes programs, data, and documentation, which is the interface between the user and the hardware
The basic principle of computer is stored program and program control. The instruction sequence (program) and the raw data of directing the computer to operate in advance are conveyed to the computer memory by the input device, and each instruction explicitly specifies which address the computer takes, what to do, and then what address to wait for the step. When the computer is running, the first instruction is removed from the memory, and the decoding of the controller, according to the requirement of the instruction, takes the data from the memory to perform the processing of the specified arithmetic and logic operation, and then sends the result to the memory by the address. Next, take out the second instruction and complete the specified operation under the command of the controller. Proceed until the Stop command is encountered. The program and data storage, according to the Order of the program, step-by-step take out the instructions, automatic completion of the instructions prescribed by the computer is the most basic principle of operation.
2, computer language
Computer Language is a language that can be recognized by computers, and used for communication and communication between people and computers .
Hair Show: Machine language and assembly language-- high-level languages (c,C + +, OC, JAVA)
3, program
A program is a set of command sequences that can accomplish a specific function, with multiple commanding computers
Program Essence: is a bunch of data and instructions , loaded into the computer can do a variety of operations
4, the computer can only recognize binary data, why?
1, simple hardware design, low cost
2, high stability
3, in accordance with the life of (true and false, right and wrong) logic
5, Binary
Rounding, a form of rounding that people have agreed on, and for any X-binary, the value of a binary bit
Ii. conversion of the binary system
1, decimal: Cardinal 0~9, every ten into one
123=1*10^2 + 2 *10^1+3*10^0
2, binary: Radix 0,1 , every two into a
Decimal to binary: Except 2, write in reverse
110100 = (b)
= 11111010 (b)
3, octal: radix 0~7 , every eight into one
Octal goto Decimal:
034 = 3*8^1+4*8^0=28
Octal binary binary: Octal one represents 3-bit binary number
034 = 011 100
Binary turn octal:
10101010 (b) = 0252
4, 16 binary: radix 0~9, a~F, every 16 into a
Hexadecimal to decimal:
0xfe34 = 15*16^3 +15*16^2+3*16^1+4*16^0
Hex to binary: Hexadecimal 1-bit indicates 4-bit binary number
0xfe34 =1111 1110 0011 0100 (b)
Binary turn 16 binary:
11101111101010 (b) = 0x3bea
The data in the program is not stored in binary but in hexadecimal, why?
1, write shorter than binary
2, convenient with binary conversion
The 3,c language does not support binary writing, and the data in the program is written in whichever form, and is ultimately stored in binary form.
Iii. Data and storage
The original code of the positive number, the inverse code and the complement are all themselves
Negative number of the inverse code: corresponding to the original code symbol bit unchanged, the remaining bits take the reverse
The complement of negative number: the corresponding anti-code plus 1
The data in the program is ultimately stored in the form of a complement, why?
1. Convert subtraction to addition, simplify hardware design, save cost
2, the symbol bit participation in the operation, no need to consider separately, but also simplifies the design
where is the data stored in the program: stored in memory, we artificially contract 8 bits for a byte to occupy a storage unit, and then < Span class= "Apple-tab-span" > using a positive Integers to number these cells, we don't actually use the address number why?
< Span class= "Apple-tab-span" > 1 Address Book write more cumbersome, error-prone
< Span class= "Apple-tab-span" > < Span class= "Apple-tab-span" > 2 Actually we don't know which addresses are available
< Span class= "Apple-tab-span" > < Span class= "Apple-tab-span" > 3 we can give a storage Span class= "Apple-tab-span" > space takes a name and accesses the specified storage space by this name
C Fragmentation One computer knowledge