1. cin. get ()
Purpose: To prevent some programs from closing the window after outputting the results.
Purpose: Read the next keyboard strike. All the keyboard hits are not sent to the program until you press Enter.
Ii. New C ++ Style
Header file: C ++ proprietary iostream
C proprietary cmath // is omitted ". h"
3. namespace
Purpose: Enable the name defined in the C ++ standard class library to be used in this program
Usage: using namspace std;
Explanation: All identifiers in the C ++ standard library are defined in a namespace named std.
Example: using namespace Compilation instruction,
[Html]
# Include <iostream>
Using namespace std; // must be added before cout can be used
Int main ()
{
Cout <"sdf ";
}
Cause: <iostream> and <iostream. h> the format is different. The former has no suffix. In fact, you can see in your compiler include folder that the two are two files. When you open the file, you will find that the code inside is different .. H header file c ++ standards have been explicitly proposed not to support, earlier implementation of the standard library function defined in the global space, declared in the. in the header file with the suffix h, the c ++ standard is used to distinguish it from C, and to correctly use the namespace, it is required that the header file does not use the suffix. h. Therefore, when <iostream. h> when <iostream> is used, it is equivalent to calling the library function in c and using a global namespace, that is, the early c ++ implementation, the header file does not define a global namespace. You must use namespace std; To use cout correctly.
4. Reveal "cout <", "cin>"
Concept: cout is an object of the iostream class, which has a member operator <. Each call will output content to the output device (usually the screen. In the final analysis, it is the overload of the operator "<".
Example: cout. operator <("Hello, World! "). Operator <(endl );
Cout <"Hello, World! "<Endl; identical functions
Supplement: endl is a manipulator that not only implements line feed operations, but also refreshes the output buffer. What does it mean? After the output operation, the data is not immediately transmitted to the output device, but first enters a buffer zone. When the appropriate time (such as when the device is idle), the data is passed in by the buffer zone, you can also force refresh by using the operator flush, ends, or unitbuf.
Purpose: insert the string into the output stream.
Intelligence: automatically outputs the desired results based on the variable declaration type.
5. Pre-compile
Concept: Pre-compilation, also known as preprocessing, is the replacement of some code texts.
Usage: # include <iostream>
Purpose: Replace the content of the iostream file with the # include <iostream> command
Supplement: <> Search for files in the INCLUDE directory of the system, and search for files in the current directory. Generally, this file is a header file with the suffix "h" or "cpp.
From the column of ODA