C++(func seperate&file organize)

#include <iostream>
#include "distance.h"

int main() {

    std::cout << distance(3, 4, 5) << std::endl;  
    std::cout << distance(7.0, 2.1, 5.4) << std::endl;

    return 0;   
}

Function declaration

write the function declaration in "functionname.h" file.

Include "functionname.h":paste declaration in the main.cpp.

include" " : search the file from current dictionary.

include<> :search the file from where the library install.

Function definition

write the function definition in "functionname.cpp" file.

use 'g++ main.cpp functionname.cpp' to compile the whole code.