[C++] Dark Horse Programmer "C++ From Entry to Proficiency" Part 8: Bugs and Thinking

Part 1: Basic knowledge

Introduction to C++ basic knowledge: https://blog.csdn.net/m0_37882192/article/details/109103335

Part 8: Bugs and Thinking

01, the difference between iostream and iostream.h and stdio.h

Link: https://blog.csdn.net/m0_37882192/article/details/108954852

02, the difference between #define and const

#define macro constant
const modified variable

03. What does using namespsce std mean?

The so-called namespace refers to the various visible ranges of identifiers. All identifiers in the C++ standard library are defined in a namespace named std. std is a namespace in C++, called the standard namespace.
Declare to use all identifiers in the std space.

04. What does the data type mean?

To create a variable or constant, you must specify the corresponding data type, otherwise memory cannot be allocated to the variable.

05. What does cout << "" << endl; mean?

cout<<endl; means output newline.
Cout is an object defined in the standard library iostream
<< is the output stream.
endl=end of line
In other words, the content of bai output on the screen is changed to the next line.
Before use, you need to use the #include header file, and write using namespace std or std::endl; in the corresponding function.

06. What is the role of return 0 in C++?

The C++ standard stipulates that the return value of the baimain function is of type int, so the return statement must be used at the end to return a value. This value will be returned to the operating system, a return of 0 indicates that the program runs successfully, and a non-zero value indicates that the program encountered a problem.
The return value can be read in the operating system and is used to tell the caller the status information of the program execution (such as: normal return, exception, error, etc.).
The return statement without return value is used to interrupt the return value of void type. The execution of the function
return 0 indicates that the program exits normally and returns to the main program to continue execution.
return 1, indicating that the program exited abnormally, return to the main calling function for processing, and continue execution. Return 0 or return 1 has no effect on the order of program execution, but people are used to using return (0) to exit subroutines.

07, C++ shortcut keys

ctrl+k,c comment the selected line
ctrl+k,u uncomment the selected line

CTRL + SHIFT + B: Generate the solution
CTRL + F7: Generate and compile
CTRL + O: Open the file
CTRL + SHIFT + O: Open the project
CTRL + SHIFT + C: Display the class view window
F4: Display the properties window
SHIFT + F4: Display the project Properties window
CTRL + SHIFT + E: Display resource view
F12: Go to definition
CTRL + F12: Go to statement
CTRL + ALT + J: Object browse
CTRL + ALT + F1: Help content
CTRL + F1: Dynamic help
F1: Help
SHIFT + F1: Current window help
CTRL + ALT + F3: Help-Search
SHIFT + ALT + ENTER: Full screen display
CTRL + -: Position backward
CTRL + SHIFT + -: Position forward
CTRL + F4: Close document window
CTRL + PAGE DOWN: Position the cursor above the window
CTRL + PAGE UP: Position the cursor below the window
CTRL + F6:
CTRL + TAB: the next document window
CTRL + SHIFT + F6:
CTRL + SHIFT + TAB: the previous document window
ALT + F6: the next panel window
CTRL + K, CTRL + L: cancel remark
CTRL + K, CTRL + C: comment the selected code
CTRL + K, CTRL + U: cancel the comment of the selected code
CTRL + M, CTRL + O: Folding code definition
CTRL + M, CTRL + L: Expanding code definition
CTRL + DELETE: Delete to the end of the word
CTRL + BACKSPACE: Delete to the beginning of the word
SHIFT + TAB: Cancel the tab
CTRL + U: Turn to lowercase
CTRL + SHIFT + U: turn uppercase
CTRL + SHIFT + eND: select to end of the document
CTRL + SHIFT + HOME: select to end of the document starts
SHIFT + eND: selection to the end
SHIFT + HOME: selection to the beginning of the
SHIFT + ALT + eND: vertical selection to the last End
SHIFT + ALT + HOME: select vertically to the front
CTRL + A: select all
CTRL + W: select the current word
CTRL + SHIFT + PAGE UP: select to the front of the page
CTRL + SHIFT + PAGE DOWN: select to the back of the page
CTRL + END: Position the document to the end
CTRL + HOME: Position the document to the front
CTRL + G: Go to...
CTRL + K, CTRL + P: Previous tab
CTRL + K, CTRL + N: Next tab
ALT + F10: Debug-ApplyCodeChanges
CTRL + ALT+ Break: Stop debugging
CTRL + SHIFT + F9: Cancel all breakpoints
CTRL + F9: Allow interruption
CTRL + SHIFT + F5: Debug-restart
F5: Run debugging
CTRL + F5: Run without debugging
F10: Execute across the program
F11: Step by step execution
CTRL + J: List members
CTRL + PAGE DOWN: Next View
CTRL + B: Format-bold
CTRL + SHIFT + T: Format-text indent

Debug shortcuts

F6: Generate solution
Ctrl+F6: Generate current project
F7: View code
Shift+F7: View form designer
F5: Start debugging
Ctrl+F5: Start execution (no debugging)
Shift+F5: Stop debugging
Ctrl+Shift+F5 : Restart debugging
F9: Switch breakpoints
Ctrl+F9: Enable/stop breakpoints
Ctrl+Shift+F9: Delete all breakpoints
F10: Step by step
Ctrl+F10: Run to the cursor
F11: Step by statement

Edit shortcut

Shift+Alt+Enter: switch full screen editing
Ctrl+B,T / Ctrl+K,K: switch bookmark switch
Ctrl+B,N / Ctrl+K,N: move to the next bookmark
Ctrl+B,P: move to the previous One bookmark
Ctrl+B,C: Clear all tags
Ctrl+I: Progressive search
Ctrl+Shift+I: Reverse progressive search
Ctrl+F: Find
Ctrl+Shift+F: Find in the file
F3: Find the next
Shift +F3: Find the previous one
Ctrl+H: Replace
Ctrl+Shift+H: Replace
Alt+F12 in the file : Find symbols (list all the search results)
Ctrl+Shift+V: Clipboard cycle
Ctrl+Left and right arrow keys: Yes once Move a word
Ctrl+up and down arrow keys: Scroll the code screen without moving the cursor position.
Ctrl+Shift+L: Delete the current line
Ctrl+M,M: Hide or expand the current nested folding state
Ctrl+M,L: Set all processes to the same hidden or expanded state
Ctrl+M,P: Stop outline display
Ctrl+E,S: View blank
Ctrl+E,W: Automatic line wrapping
Ctrl+G: Go to the specified line
Shift+Alt+Arrow keys: Select rectangular text
Alt+Left mouse button: Select rectangular text
Ctrl+Shift+U: All changes to uppercase
Ctrl+U: All changes to lowercase

Code shortcuts

Ctrl+J / Ctrl+K,L: List members
Ctrl+Shift+Spacebar / Ctrl+K,P: Parameter information
Ctrl+K,I: Quick information
Ctrl+E,C / Ctrl+K,C: Comment selected Content
Ctrl+E,U / Ctrl+K,U: Unselect the comment content
Ctrl+K,M: Generate method stub
Ctrl+K,X: Insert code snippet
Ctrl+K,S: Insert outer code
F12: Go to The definition of the calling procedure or variable

Window shortcuts

Ctrl+W, W: Browser window
Ctrl+W, S: Solution manager
Ctrl+W, C: Class view
Ctrl+W, E: Error list
Ctrl+W, O: Output view
Ctrl+W, P: Properties Window
Ctrl+W, T: Task list
Ctrl+W, X: Toolbox
Ctrl+W, B: Bookmark window
Ctrl+W, U: Document outline
Ctrl+D, B: Breakpoint window
Ctrl+D, I: Instant window
Ctrl+Tab: Active form switching
Ctrl+Shift+N: New project
Ctrl+Shift+O: Open project
Ctrl+Shift+S: Save all
Shift+Alt+C: New class
Ctrl+Shift+A: New item

08. What does const in C++ mean? effect?

const is the abbreviation of constant, the original meaning is unchanged, not easy to change. In C++, it is used to modify built-in type variables, custom objects, member functions, return values, and function parameters.
C++ const allows you to specify a semantic constraint, and the compiler enforces this constraint, allowing the programmer to tell the compiler that a certain value remains unchanged. If a certain value does remain unchanged in programming, you should explicitly use const, so you can get the help of the compiler.

Link: https://www.runoob.com/w3cnote/cpp-const-keyword.html

Guess you like

Origin blog.csdn.net/m0_37882192/article/details/109574025