A large collection of difficult questions for beginners in Visual C++ programming (1)

Beginners have many questions when learning visual c++. Interestingly, many of the questions are not mentioned in the textbook. Many friends in the background asked me related questions, so I summarized them. This is for friends who are learning visual c++ to avoid detours.

Question 1: How to run a program quickly?

Double-click Visual Studio 2002, run

Click "Create New Project".

Select "Console Application" and click "Next".

Click "Create" to generate the simplest C++ program.

Question 2: What should I do if the font size in Visual Studio is too small?

Click Tools - Options - Environment - Fonts and Colors in the VS menu to modify the fonts and colors in the interface shown above.

Question 3: How can I run my code quickly?

Select the "Debug->Start Execution" menu, or shortcut key Ctrl+F5 Run the program.

Question 4: How to annotate programs in visual C++?

The explanatory text added to the program explains the flow or function of the code to facilitate yourself and other programmers to read and understand the code. The compiler will ignore comments when compiling source code.

1单行notes

starts with two backslashes, usually is placed above the code, or one line End of statement.

Note: The two backslashes in the string content are part of the content, not comments.

2)multiline annotation

从/*Start, arrive*/Conclusion , The contents are small.

Note: a) /* and */ in the string content is part of the content, not a comment; b) /* and */ can appear in the middle of a line of code.

3NoteNote

Single-line comments can comment multi-line comments, and multi-line comments can also comment single-line comments. However, this is not recommended.

4)VSmedium speed key

Additional note: Ctrl+k+c

Cancel order: Ctrl+k+u

Question 5:What are the logical operators in visual C++?

Returns a new logical factor based on the given logical factor (expression or value).

operator

the term

Example

result

&&

logical AND

a&&b;

If a and b are both true, the result is true, otherwise it is false.

||

logical or

a||b;

If one of a and b is true, the result is true. If both are false, the result is false.

!

logical negation (reverse)

!a;

If a is false, then !a is true; if a is true, then !a is false.

Notice:

  1. Both sides of a logical operator can be numerical values ​​or expressions;
  2. When using std::cout to output a logical expression, the logical expression must be enclosed in parentheses;
  3. In actual development, multiple combinations of logical operations are the focus.

About the author: Liyuan Breeze, born in 1981, senior engineer, master of engineering from Zhejiang University, software engineering project manager, worked as a programmer, software designer, system architect, early Windows programmer, loyal user of Visual Studio, user of C/C++ The author is a veteran who has studied, struggled, and struggled in the computer industry for 25 years. He has experienced the UNIX era, the desktop WIN32 era, the Web application era, the cloud computing era, the mobile Android era, the big data era, the ICT era, and AI deep learning. era, the era of intelligent machines, I don’t know what era there will be in the future. I just remember that this journey has been full of hardships and gains. I am willing to go on with everyone and go on full of hope.

Guess you like

Origin blog.csdn.net/wang2015cn/article/details/134050614