hour04_1.cpp

来自「《24学时精通c++》的随书源码的下半部分。欢迎下载学习。」· C++ 代码 · 共 28 行

CPP
28
字号
 #include <iostream>

 

 int main()

 {
     int a;

  // Compile and run with only the first (a = a + 1) line uncommented.
  // Compile and run with only the second (a += 1) line uncommented.
  // Compile and run with only the third (a++) line uncommented.

  // You may see a size difference in the executable (but it will be small)

  // However, the compiler may decide that the statement you entered can be
  // replaced with the faster/simpler form (second or third line) and then
  // you will see no difference -- this is optimizing!

  // You probably won't see a time difference since it is really so small (and 
  // optimization may occur)

     a = a + 1;
  // a += 1;
  // a++;

     std::cout << "result is " << a << std::endl;


     return 0;

 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?