I recently moved from Java for C++ but now when I am writing my application I\'m not interested in writing everything of the code in the main function I want in main functio
You must use a tool called a "header". In a header you declare the function that you want to use. Then you include it in both files. A header is a separate file included using the #include
directive. Then you may call the other function.
void MyFunc();
#include "other.h"
int main() {
MyFunc();
}
#include "other.h"
#include
void MyFunc() {
std::cout << "Ohai from another .cpp file!";
std::cin.get();
}