How do I include a different file into my main.cpp?

Like I want to include a file which has different code in it. I forgot how to do that :s. Also, my question is when I do that, it's basically like putting in all the code into my main file right?
1
2
3
4
5
#include "myfile.h"

int main()
{
}
Sweet thanks, also what's the difference between <> and "" when you're including files.
Example: #include<iostream> and #include"iostream" ?
<> will look in the default location specified by your IDE/compiler, while " will look into the current folder first, if it doesn't find the file, it looks in the IDE/compiler-specified folder.
Oh, so which method is preferred?
It depends on the situation. If your header file is intended to be used by other people then use <>, if it is intended to be local to your project than "" is fine.
Last edited on
Topic archived. No new replies allowed.