C ++ Study Notes (2)

Source: Internet
Author: User
Tags lenovo

C ++ Study Notes (2)

This learning note is C ++ primer plus (version 6. Is the follow-up of C ++ Study Notes (1. You can view basic C ++ knowledge.

For more information, see http://www.cnblogs.com/zrtqsk/p/3878593.html. thank you! As follows.

 

Chapter 5

1. for Loop -- for (initialization; test-expression; update-expression) body // test-expression will be converted to bool, 0 is false, and non-zero is true

 

2. expression-the expression is a combination of values or values and operators. The value of the value assignment expression is the value of the member on the left, while the value assignment operator combines the value from the right to the left.

 

3. a ++ and ++ --

(1) The two built-in types have the same execution efficiency.

(2) If the operator is overloaded, the prefix will add 1 to the class and return the result. The suffix will copy a copy and Add 1 to return the copy. Therefore, prefixes are more efficient than suffixes.

 

4. Comma operator --

(1) In a for loop, multiple expressions are combined into one: I ++, j ++;

(2) Declaration: int I, j;

(3) The comma expression calculates the first expression and then the second expression. The value of the comma expression is the value of the second part.

(4) The comma expression is the expression with the lowest priority.

 

5. strcmp () -- compares two strings. Two string addresses A and B are accepted as parameters. If AB is the same, 0 is returned. If A is prior to B, negative numbers are returned. Otherwise, positive numbers are returned.

(The String constant enclosed in quotation marks is its address .)

 

6. clock () -- return the system time used after the program starts execution. This value is divided by CLOCKS_PER_SEC to get the number of seconds.

 

7. Type alias -- # define AA char // use AA as the alias of char, and all AA will be replaced by char

OrTypedef AA char

 

8. cin -- cin. get () ignores spaces and line breaks. The input sent to cin is buffered. Press the Enter key to send the entered content to the program.

Cin. get (ch) returns each character. Its Parameter declaration is a reference type, so the function can modify its parameter value.

 

9. EOF-many PC programming environments regard Ctrl + Z as the simulated EOF. After detecting EOF, cin sets both eofbit and failbit to 1. Eof () and fail () are used to check whether they are set.

Therefore, the following conditions can be set for loop wait input: while (cin. fail () = false) {} Or whle (! Cin. fail () {} or while (cin. get (ch )){}

(Generally, EOF is defined as-1)

 

Chapter 6

 

10. Operator --! Operators take precedence over all Relational operators and arithmetic operators.

The logical AND operator has a higher priority than the logical OR operator.

C ++ ensures that the program calculates the logical expression from left to right.

 

11. cctype-character function library. For example, if isalpha (ch) is used to determine whether a character is a letter or not, a non-zero value is returned if it is a letter. Otherwise, 0 is returned.

 

12. Text IO-when using cin for input, the program regards the input as a series of bytes, each of which is interpreted as character encoding.

 

Chapter 7

 

13. Define a function --

(1) No Return Value: void functionName (parameterList ){}

(2) Return Value: typeName functionName (parameterList ){}

(Note! The returned value type cannot be an array or any other type)

 

14. function prototype --

(1) function prototype can greatly reduce the probability of program errors and improve efficiency.

(2) The function prototype does not require a variable name. It is sufficient to have a type list.

(3) Empty brackets are equivalent to void in brackets. If the parameter list is not specified, the ellipsis -- void haha (...) should be used (...);

 

15. Functions and two-dimensional arrays --The pointer type removes the rest of the pointer name in the pointer declaration statement.

For: int data [3] [4] = {1, 2, 3, 4}, {5, 6, 7, 8}, {4, 3, 2, 1}; int total = sum (data, 3); what is the prototype of sum?

(1) The prototype is:Int sum (int (* a) [4], int size ); 

  So int (*) [4] points this pointer to int [4]. So the data typePointByPointer to an array consisting of four int values

  So the int * a [4] type is int * [4]. This Pointer Points to int, and there are four in total, that is, it isFour arrays composed of int pointers.

(2) Function Definition: int sum (int a [] [4], int size );

  A [r] [c] = * (a + r) + c ); 

 

16. recursion-each recursive call creates its own set of variables.

(Note! C ++ does not allow main () to call itself .)

 

17. function pointer --

(1) function address: The function address is the memory start address for storing the machine language code. If think () is a function, think is its address.

(2) Declare pointer function: double pam (int); pointer function: double (* pf) (int) = pam; // pf is a pointer to a function.

  

Chapter 8

 

18. compilation process-the final product of the compilation process is an executable program (composed of a group of machine language commands ).

When running a program, the operating system loads these commands into the computer memory, so each command has a specific memory address. The computer then gradually executes these commands.

 

19. function call-when a function call instruction is executed, the program immediately stores the memory address of the instruction after the function call and copies the function parameters to the stack, jump to the memory unit that marks the start of the function,

Execute the function code (You may also need to put the returned value into the register), and then jump back to the instruction where the address is saved.

 

20. inline functions-the compiler uses the corresponding function code to replace function calls.

Add the keyword inline before the function declaration, and add the keyword inline before the function definition. The prototype is usually omitted and is directly defined at the prototype.

 

21. Reference a variable -- mainly used as a function parameter. The function uses the original data instead of its copy.

(1) Create: int rats; int & a = rats;

(2) The reference must be initialized at the time of declaration. It cannot be declared before initialization. You cannot set references by assigning values.

(3) A reference is always loyal once it is associated with a variable.

(4) If the referenced parameter is const and the real parameter type is correct but not the left value or the type is incorrect but can be converted to the correct type,Temporary variables will be created.

(5) When returning a reference, avoid memory unit reference that no longer exists when the return function is terminated.

 

22. left --

(1) data objects that can be referenced. Such as variables, array elements, structure members, referenced and unreferenced pointers, etc.

(2) Non-left values, including literal constants and expressions containing multiple numbers.

(3) Regular variables are modifiable left values, and const variables are unchangeable left values.

 

23. Right Value reference-you can reference the right value and use & declaration. For example, double & rref = std: sqrt (26.00 );

 

24. default parameter-set the default value of the function parameter through the function prototype.

(1) The default value must be added from right to left.

(2) The real parameters are assigned to the form parameters in the order from left to right, rather than skipping any parameters.

 

25. Function overload-the parameter list (feature mark) is different, and the function name is the same.

(1) type reference and type itself are considered as the same feature mark.

(2 ),The const variable cannot be assigned to a non-const parameter.

 

26. Name modification-each function name is encrypted Based on the parameter type specified in the function prototype to track every overloaded function.

 

27. Function template-equivalent to the generic type in Java

(1) Declaration: template <typename T> void Swap (T & a, T & B); // typeName can be replaced by class

(2) The function template cannot shorten the executable program. The final Code does not contain any template and only contains the actual function generated for the program.

(3) generally, the template is placed in the header file.

 

28. Explicit embodiment-a specific function definition. When matching, use it instead of a template.

(1) Non-template functions:Void swap (job &, job &);

(2) template functions:Template <typeName T> void swap (T &, T &);

(3) Explicit embodiment:Template <> void swap <job> (job &, job &);// Swap <job> job is optional.

(4) When the compiler selects a prototype: Non-template function> explicit embodiment> Template Function

(5) Explicit instantiation:Template void swap <int> (int, int );// None after template <>

(6) Implicit instantiation: For template functions, the compiler will generate an instance with a reference to the number of template values. This is usually called implicit instantiation.

 

29. decltype -- decltype (expression) var; // make the var type the same as the expression type.

(Note! If expression is a function call, the var type is the same as the return value. If expression is a left value, var indicates a reference to its type)

 

30. Post return type -- specify the return type for the function.

For example, template <class T1, class T2> auto gt (T1 x, T2 y)-> decltype (x + y) {... return x + y ;}

 


Do you have any C Language Study Notes or prepared some documents?

Hundred examples of C language programming: it is easier to learn from examples. It is better than simply reading those books with principles //
Is it a procedural test or a theoretical test?
Recommended program design guidance and online practices for trial use, outline-level books. Link: ai.pku.edu.cn/book/
The theoretical written examination must be dominated by Tan haoqiang, but it is indeed a bit messy. You may wish to buy a related exercise or something like this. Tan haoqiang has many related exercises in this book, which are basically the same, choose based on the existing materials on hand. We will not recommend it.

Plsql Study Notes 2

There are many brands of laptops, but from the recent computer warranty and after-sales service, the most important thing is the cost effectiveness, I recommend two brands of computers "Lenovo and HP"
Below I will introduce several computers, the landlord can consider,

Lenovo

Its Y430 series are among the first in terms of sales volume of computers and attention to the Ultimate Edition.
I want to introduce three models.
Y430a-pse

The configuration is as follows:
Processor Model Intel Core 2 dual-core P7450
Nominal clock speed 2.13 GHz
Front-End bus 1066 MHz
Level 2 Cache 3 MB
Kernel architecture Penryn
Platform technology Intel Platform
Motherboard chipset Intel PM45
Standard memory capacity 2 GB
Memory type DDRIII
Supports up to 4 GB memory
Hard drive/Optical Drive
Hard disk capacity 250 GB
Hard Disk description SATA
Optical Drive Type DVD recorder
Built-in design type Optical Drive
Graphics/sound effects
Low-end independent video card
NVIDIA GeForce 9300 m gs graphics chip
Stream processor count 16
Memory/Bit Width 256 MB/64 bit
Video memory type DDRII
Audio System built-in sound chip
Speaker Dolby certified sound effects, 2.1 audios (stereo speaker + subwoofer)
Display
Screen Size: 14.1 inch
Screen Ratio
Screen Resolution: 1280x800
Screen description LED WXGA
Size/weight
2350 GB laptop weight
Shape: 334x241x26-38mm
Case Material Composite Material
Network Communication
Wireless Network Card Intel 5100AGN
Nic description Mbps Nic
Support for Bluetooth
Modem 56 K
Red outer line infrared interface
Mouse/keyboard
Device touchpad
Keyboard description Lenovo notebook keyboard with high touch
Interface
USB interface: three USB Interfaces
Extended Interface ExpressCard
Card Reader-in-One Card Reader (SD/MMC, xD, MS, MS pro, SD Pro)
Video output HDMI high-definition port and standard VGA Interface
Other interfaces, such as 1394, RJ45, and full-array noise-resistant microphones, support for stereo audio headphone jack/audio output, and
Power supply description
Battery Type 6-core lithium battery
Power adapter 90 W power adapter
Others
Windows Vista Home Basic
Warranty Period: 3 years
Associated Software Package
Random attachment mouse
Optional accessory and notebook Gift Packs (purchased separately)
Other features: 1.3 million pixels support secure and easy-to-use Face Recognition
Quiet Mode with one click
Dolby audio 2.1 audio system
Electrostatic induction multimedia touch operation
Entertainment shuttle Sound Field Control
Hdmi hd output port
Other features: Lenovo one-click rescue/Lenovo flash link Ren Yitong
Environment requirements
Operating temperature 0-35 ℃
Operation humidity parameter error 10%-90% (no condensation)

The price is around 6100, which is definitely worth the money... In particular, it has good heat dissipation performance!

The second is y430-tfi.

Configuration
Intel Core 2 dual core T5800
Nominal 2 GHz clock speed
Front-End bus 800 MHz
Level 2 Cache 2 MB
Kernel architecture Merom
Platform technology: Intel®
Motherboard chipset Intel PM45
Standard memory capacity 2 GB
Memory type DDRIII
Supports up to 4 GB memory
Hard drive/Optical Drive
Hard disk capacity 250 GB
Hard Disk description SATA
Optical Drive Type DVD recorder
Built-in design type Optical Drive
Graphics/sound effects
Low-end independent video card
NVIDIA GeForce 9300 m gs graphics chip
Stream processor count 16
Memory/Bit Width 256 MB & #47 ...... remaining full text>
 

Related Article

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.