Heavy C language learning (Deep) on the third day

Hexadecimal conversion

Binary octal: a binary number is divided by a set of three, then calculates a decimal number to each group. Code ideas: the use of a control packet cycle (array length divided by three, I need to make several Ikunori zero) and calculated for each set of data (i is defined from scratch each time by three), it may be directly output in the cycle the results may also be obtained in an array after one-time output.

Binary Hexadecimal: a binary number is divided by a set of four, then calculates decimal numbers of each group. Binary code is the same idea octal.

Binary Decimal: the first of several binary number multiplied by two minus several of the first power, and then add these numbers. Code ideas: the binary number into an array, then you can press the algorithm, apply a loop to calculate the decimal number.

Octal, hexadecimal turn: The Octal to binary, and then follow Binary hexadecimal, convert it to hexadecimal. Code ideas: the octal values ​​calculated separately for each one, each divided by modulo 2, then the remainder divided by modulo 2, until the remainder is zero, then the numbers are arranged in order from the back, i.e., available binary, hexadecimal after sub can be.

Summary: All the method for converting binary decimal binary conversion method as described above is similar to decimal, hexadecimal decimal conversion are changed to the other division, modulo, and thereafter the resultant quotient in the arrangement order from the rear to the forward.

Note: The above method is a calculation method of an integer, a float method: Decimal Hex other rounding a multiplication.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Computer memory (memory addressability represents the computer's CPU)

32 (the maximum addressable capacity 2 * 2 * 2 * 2 ^ 10 ^ 10 ^ 2 * 10 bytes, i.e., 4G):

A sixteen bit memory address binary data can be stored four, eight, sixteen memory address that is binary data store 32, or 32 bits.

 

 

 

64 (the maximum addressability: 2 * 2 * 2 * 2 ^ 10 ^ 10 ^ 10 * 2 * 2 * 2 ^ 10 ^ 10 ^ 10 bytes * 2):

 

 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When the data output analytically:

Analytically Analytical type
%d Integer
%f Float (default retained six)
%O Octal integer
%ld Long integer
%x Hex output string or integer
in% Output unsigned integer
%c  The output of a single character
%s Output a string
%100f Float, decimal reserved 100
%e Exponential output
%g Output does not contain a real number of 0, or automatically using% f% e format depending on the size
%p Take Address

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

type of data:

 

Guess you like

Origin www.cnblogs.com/stuBlogs/p/11447156.html