C++ separate code based on the few changes

Hi,

I am working in Visual studio 2008 in which i have written the code in c++,qml,qt.Its a simulator application.

I would like to create a simulator with certain changes. In order to do that i have modified the code with few changes based on the preprocessor condition.

#define SECOND_SIMULATOR

#ifdef SECOND_SIMULATOR
         code related small changes
else
         code related to main UI
#endif

Is there any way to separate the code other than preprocessor ?

There are millions of ways to separate the code other than using the preprocessor.

What do you want to use other than whether or not SECOND_SIMULATOR has been #define d to make the decision of what code to use?

Thanks for your quick reply. Could you tell me any of 2 ways.
I would like to know the efficiency of using this and other ways.so I can use the better one.
Thank you

There is no possible way to answer that question until you explain what you are trying to do!

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.