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; } }
  • 相关阅读:
    springboot maven打包插件
    maven打包指定main入口插件
    团队开发环境一致性性要求
    springboot 在idea中实现热部署
    IDEA 2018.1可用License服务(持续更新)
    IDEA打jar包
    3月18号
    3月17号
    3月16号
    3月13号
  • 原文地址:https://www.cnblogs.com/i80386/p/4377781.html
Copyright © 2011-2022 走看看