Data types

Laten we beginnen. Het is Gratis
of registreren met je e-mailadres
Data types Door Mind Map: Data types

1. string streams

1.1. cin > > will remove the preceding space

1.2. getline will remove the carriage return at the end

2. int subtypes

2.1. char type

2.1.1. Common characters

2.1.2. Escape character

2.1.2.1. \r enter

2.1.2.2. \b backspace

2.1.2.3. \+’ ”? equal to the original

2.1.2.4. l + \ = = \

2.1.2.5. can add 1-3 octal integers or 1-2 hexadecimal integers, such as 101 '= =' a '=' \ \ x 41 '

2.1.3. Character types can also be treated as integers, but character types output characters and integers do not

2.2. enum type

2.2.1. example:enum bool {false , true } ;

2.3. bool type

3. float types

3.1. floating point no. representation

3.2. floating point type range

3.2.1. ① Scientific counting method 0.22e-6

3.2.2. After + f or float, such as 12F

3.2.3. after + Llong double if 1 2 L

4. C string and string

4.1. c string

4.1.1. Inherited from C is essentially an array

4.1.2. There is a 0 at the end, also called aski string

4.1.3. Add 0 to the size of the open array to add one more space

4.1.4. const char *

4.2. char pointers and char arrays

4.2.1. C string is a pointer. Compare with = = because the address is different, the result must be unequal

4.2.2. Char STR 2 = STR 1 / / str 1str 2 space

4.2.3. The whole copy of array is forbidden

4.2.4. New Topic

4.2.5. c string

4.2.5.1. strcpy ( char * x 1 , char * x 2 ) x 2 x 1

4.2.5.2. StrCmp (char XX 1, char * x 2) x 1, otherwise, return an integer equal to 0

4.2.5.3. Strcat (char * x 1, char * x 2) x 2 x 1 returns the address of x1

4.2.5.4. strrev ( char * x )

4.2.5.5. strset ( char * x 1 , char x 2 ) x 2

4.2.5.6. strchr ( char * x , char * s ) 1

4.3. string

4.3.1. St type

4.3.2. Direct + (splicing) = = (comparison)

5. int types

5.1. binary complement

5.1.1. Positive number takes negative by bit + 1 → negative number

5.1.1.1. Inverse operation

5.1.2. Decimal to binary: divide by 2

5.1.3. The original / complementary inverse code is represented by the highest bit

5.1.4. Negative number takes negative number by bit + 1 → positive number

5.1.4.1. Inverse operation

5.2. int range

5.2.1. The length is different in different compilers

5.2.2. char < = short < = int < = long

5.3. compiler and int length

5.4. int literals

5.4.1. Non 0 start: decimal

5.4.2. Start with 0: octal

5.4.3. Beginning with 0X: hexadecimal

5.4.4. after number + u indicate to unsigned int if 0 2 3 6 u

5.4.5. after number + long indicate to int if 1 2 3 L

5.5. int arithmetic operations

5.5.1. +,-,*,/,%,<<,>>,<<=,>>=,!,^,&,|,|| etc.

6. push _ back ( )

7. vectors

7.1. definition

7.1.1. Variable length array

7.1.2. vector < ElemType > Name

7.1.3. initialization

7.1.3.1. appoint big small vector < int > a ( 1 0 ) :

7.1.3.2. big small value vector <int>a(10,1)

7.1.3.3. vector < int > a ( b ) ; vector < int > a ( b . begin 0 . b . end 0 ) ; Full and partial replication

7.1.4. Pointers and iterators

7.1.4.1. a . begin ()

7.1.4.2. a. End) the one after the end

7.1.4.3. a . back () after the end

7.1.4.4. Iterator it; * it iterator + + can be compared with begin and end

7.1.5. member

7.1.5.1. Insert delete

7.1.5.1.1. ereseo ()

7.1.5.2. Take the size a . size ( )

7.1.5.3. swap

7.1.6. 2dimensional vector

8. pointers and references

8.1. pointers/definition

8.1.1. Variable to store address

8.1.2. int pointer = & a ;

8.1.3. *Take & Address *& can be offset

8.1.4. The pointer cannot be assigned an integer value directly

8.1.5. double pointer

8.1.5.1. int * * ptr = & ptr

8.1.5.2. pointer to pointer

8.2. pointer type

8.2.1. Pointers need to be typed

8.2.2. Can cast

8.3. pointer operations

8.3.1. Pointers cannot be added. Pointers and integers can

8.3.2. Pointers can be subtracted

8.4. pointer restriction

8.4.1. pointer to const

8.4.1.1. const int * ptr ;

8.4.1.2. int const * ptr

8.4.1.3. This value is actually variable

8.4.2. const pointer

8.4.2.1. int * const ptr

8.4.2.2. The pointer itself cannot be changed

8.5. references

8.5.1. Essence: alias

8.5.2. share space

8.5.3. References can also be limited to the same as above

8.5.4. Function to modify parameters can be passed in by reference

9. conclusion

10. arrays

10.1. number of elements

10.1.1. Getline will remove the carriage return at the end

10.1.1.1. Many variables with the same name

10.1.1.2. A name is a pointer to the first address

10.1.2. big or small

10.1.2.1. int a [ 5 ] = ( 1 , 2 , 3 , 4 , 6 ) :

10.1.2.2. ( int a = ( 1 , 2 , 3 , 4 , 6 )

10.1.2.3. The subscript of an array can be a constant expression

10.2. initialization

10.2.1. The initial value cannot be empty and cannot be occupied by commas

10.2.2. If the number of initializations is less than the size of the array, it is followed by 0

10.2.3. int a : x

10.3. default values

10.3.1. Global and static arrays have default values

10.3.2. Generally 0

10.3.3. The initial value of the local array is random

10.4. 2- D arrays

10.4.1. Use a [row] column to access each value. 2 dimensional: array table of arrays.

10.4.2. 3D: stacked tables