zoukankan      html  css  js  c++  java
  • c++ 链接

    header.h

    #ifndef HEADER_H
    #define HEADER_H unsigned long getFac(unsigned short num); static const unsigned short headerNum = 5; #endif // HEADER_H_INCLUDED
    this.cpp

    #include "header.h" #include <iostream> using namespace std; extern unsigned short thatNum; //声明thatNum是来自外部的 static bool printMe = false; int main() { unsigned short thisNum = 10; cout << thisNum << "i = " << getFac(thisNum) << endl; cout << thatNum << "i = " << getFac(thatNum) << endl; cout << headerNum << "i = " << getFac(headerNum) << endl; if(printMe) { cout << "that.cpp -> printMe = true 发挥作用" << endl; } else { cout << "this.cpp -> static boolean printMe 发挥作用" << endl; } return 0; }
    that.cpp
    #include
    "header.h" unsigned short thatNum = 8; bool printMe = true; unsigned long getFac(unsigned short num) { unsigned long sum = 1; for (int i=1; i<=num; i++) { sum *= i; } if(printMe) { return sum; } else { return 0; } }
  • 相关阅读:
    web应用本质
    SQL逻辑查询语句执行顺序
    flask-WTForms组件
    生产者消费者模型
    单例模式
    flask中的信号量
    flask-script
    flask-session
    在python项目中导出项目依赖的模块信息
    Flask简介之简单应用
  • 原文地址:https://www.cnblogs.com/i80386/p/4377781.html
Copyright © 2011-2022 走看看