Sunday, August 2, 2009

Is it possible to use two cpp files at a time?

I am a c++ beginner ... I would like to know if there is a way to make a program like this: At the beginning, there is a condition which if true , a cpp file is opened.... if not another cpp file is opened (having a totally different main and different function....... note: i use visual studio 2005!!

Is it possible to use two cpp files at a time?
When you create an exe file, the C++ files are compiled and then linked together to the exe file. When you start the exe file, you can't access the c++ files anymore - they are totally irrelevant anyway, because all the compiled code is in the exe file.





however, you can create several c++ files and add them to your project. this is even recommended - it's better for your organization of the source code.





now each c++ file has different functions and you can call all those functions from your main function (or from any other function), if you have a header file with the function declarations.

bloom

No comments:

Post a Comment