onthefly.cpp

来自「Thinking in C++ 2nd edition source code 」· C++ 代码 · 共 21 行

CPP
21
字号
//: C03:OnTheFly.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// On-the-fly data definitions

int main() {
  //..
  { // Begin a new scope
    int q = 0; // Plain C requires definitions here
    //..
    for(int i = 0; i < 100; i++) { // Define at point of use
      q++;
      // Notice q comes from a larger scope
      int p = 12; // Definition at the end of the scope
    }
    int p = 1;  // A different p
  } // End scope containing q & outer p
} ///:~

⌨️ 快捷键说明

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