首先添加一个头文件,名为fn1.h 之后,在你的主程序cpp源文件中, #include <iostream> using namespace std; #include "fn1.h" int n; int main() { n = 20; fn1(); cout << "n的值为" << n; return 0; } VS2015 调试结果
#include <iostream> using namespace std; #include "fn1.h" int n; int main() { n = 20; fn1(); cout << "n的值为" << n; return 0; }
64,654
社区成员
250,484
社区内容
加载中
试试用AI创作助手写篇文章吧