Separate files in program

Hi Guys

I have am creating a C++ program for uni, and we have been asked to design a cinema system. Is there away that i can make different files for each part of the C++ program and then have one main file that i can call those pages in when i need them.

Does that make sense

Thanks
Michael
Yes. This is standard in C++. You can spread your functions across as many different cpp files as you like. The compiler turns each into a single object file and the linker then binds all the object files into a library or executable.

Don't think in terms of files for anything other than arranging your text. Once the program has been compiled and linked, whatever separate files you started with has become completely meaningless and irrelevant.
Last edited on
Awesome so i could have a file structure like:
Film Times.cpp
bookings.cpp
confirmation.cpp

etc

how do you link the files together. I am still very new to C++
On the command line, it would look like:

g++ FilmTimes.cpp bookings.cpp confirmation.cpp


If you're using an IDE, it's dependent on that. Note that filenames with spaces in is simply asking for trouble.
Topic archived. No new replies allowed.