prog10_02.cpp

来自「c++最经典的入门书籍」· C++ 代码 · 共 20 行

CPP
20
字号
// Program 10.2 Using a namespace   File: prog10_02.cpp
#include <iostream>
#include <string>

namespace data {
  extern const double pi;        // Variable is defined in another file
  extern const std::string days[];  // Array is defined in another file
}

int main() {
  std::cout << std::endl
            << "pi has the value " 
            << data::pi << std::endl;

  std::cout << "The second day of the week is " 
            << data::days[1] << std::endl;

  return 0;
}

⌨️ 快捷键说明

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