In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the programming skills of C++". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought slowly and deeply. Let's study and learn what C++ programming skills are.
1. Debug mark
Apply preprocessing # define to define one or more debug tags, and manage the debug part using # ifdef and # endif in the code. When the program is finally debugged, you only need to use the # undef tag, and the debug code will disappear. The commonly used debugging is marked as DEBUG, and the statement sequence:
# define DEBUG
# ifdef DEBUG
Debug code
# endif
two。 Debug markup during run
Turns the debug flag on and off while the program is running. This can be achieved by setting a debug bool tag. This is more convenient for programs run on the command line.
For example, the following code
# include < iostream > # include < string > using namespace std; bool debug= false; int main (int argc,char*argv []) {for (int iDebug I < argc;i++) if (string (Arg v [I]) = = "--debug=on") debug= true; bool go=true; while (go) {if (debug) {debugging Code} else {}}
3. Convert variables and expressions to strings
However, use the string operator to implement the conversion output definition
# define PR (x) cout < < # x "=" < < x < <'\ n'
4.C language assert ()
The macro in < assert >, when using assert, gives him an argument, that is, an expression that is read as true. The preprocessor generates code to test the assertion, and if the assertion is not true, it sends an error message telling what the assertion is and fails for a while, and the program terminates.
# include < assert > using namsapce std; int main () {int iTunes 100; assert (iTunes 100) / / Fails} after debugging, add # define NDEBUG in front of # include < assert > to eliminate the code generated by red} Thank you for reading, above is the content of "C++ programming skills". After the study of this article, I believe you have a deeper understanding of what C++ programming skills have, and the specific use still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.