zoukankan      html  css  js  c++  java
  • 注释

    作用:用于对代码进行解释说明

    单行注释:

      \.........

    多行注释:

      *  ......

          ...... 

          ...... *

    嵌套注释:

           #if condition

          ...

            #endif

        #if 0
            cout << "branch1" << endl; //执行该语句
        #else
            cout << "branch2" << endl;
        #endif
    
    
        #if 1
            cout << "branch1" << endl;
        #else
            cout << "branch2" << endl;  //执行该语句
        #endif

      这种形式对程序调试也可以帮助,测试时使用 #if 1 来执行测试代码,发布后使用 #if 0 来屏蔽测试代码

      #if 后可以是任意的条件语句

      下面的代码如果 condition 条件为 true 执行 code1 ,否则执行 code2

      #if condition
        code1
      #else
        code2
      #endif
  • 相关阅读:
    07 JavaWeb
    06 XML编程(CRUD)
    05 XML
    04 DOM一窥
    03 Javascript初识
    02 CSS/javaScript
    01 HTML基础
    09_IO流
    08_集合概述
    07_基本数据类型和包装类
  • 原文地址:https://www.cnblogs.com/shiliye/p/13746458.html
Copyright © 2011-2022 走看看