c++中头文件和源文件的使用
head.h中
#ifndef HEAD_H
#define HEAD_H
void sum(const int &a,const int &b);
#endif
source.cpp中
#include<iostream>
#include"head.h"
void sum(const int &a,const int &b)
{
std::cout << a+b << std::endl;
}
main.cpp中
#include"head.h"
#include<iostream>
using namespace std;
void print(const int &);
int main()
{
int a= 5, b = 19;
sum(a,b);
return 0;
}