C++学习笔记6:多文件编程

1.添加文件到工程中;

2.函数调用时需要前向声明;以下为实例:

//add.cpp
int add(int x, int y)
{
    return (x + y);
}
//main.cpp
#include "iostream"
using namespace std;

int add(int x, int y);

int main(void)
{
    cout << "the result is:" << add(3,5) << endl;
    cin.get();
    return 0;
}
怕什么真理无穷,进一寸有一寸的欢喜。---胡适
原文地址:https://www.cnblogs.com/hujianglang/p/6128904.html