Is it possible to do that? If so,can anyone give a theory or something? Thanks :)
By the way I am using turbo compiler 3.0

What is it that you are trying to do? The question has a number of answers, dependent upon your goals.

1. If you want to take C++ code, compile it, and access/run it inside an already running code that is one thing.
2. If you want to take C++ code, compile it, and run it separately, that is something else entirely.

In the case of #1, that is very difficult (not necessarily impossible). In the case of #2, that is not difficult. Let us know more of what you are trying to do, and maybe we can point you in the right direction. "Give a person a fish, and they will eat for a day. Teach a person to fish, and they will never go hungry."

>>By the way I am using turbo compiler 3.0
OMG! That's a 20 year old compiler! This is archaic! Please consider switching to something newer. With that compiler, I'm doubting you could even compile whatever code you would like to compile, "within a C++ program" or not (whatever that means, as rubberman has pointed out). Consider maybe MinGW GCC, it is free and always reasonably up-to-date.

Comments
This always bears repeating.

Well then its #3...I want to compile a code through another code,then access it separately. :)

>>By the way I am using turbo compiler 3.0
OMG! That's a 20 year old compiler! This is archaic! Please consider switching to something newer. With that compiler, I'm doubting you could even compile whatever code you would like to compile, "within a C++ program" or not (whatever that means, as rubberman has pointed out). Consider maybe MinGW GCC, it is free and always reasonably up-to-date.

I would if I could,but that's what is being used at our school, and I guess I better use that for now before shifting to standard c++.

Ok.

1. Write the code to an external .cpp file.
2. Use the system("TCXX progname.cpp") function, where "TCXX" is the name of the Turbo C++ compiler. Assuming it succeeds in compiling, go to #3.
3. Use the system() command to execute the program as in system("progname arglist") where arglist is the list of arguments to pass to the program.

This is just a general road map. Remember, the Devil's in the details... :-)

Ok.

1. Write the code to an external .cpp file.
2. Use the system("TCXX progname.cpp") function, where "TCXX" is the name of the Turbo C++ compiler. Assuming it succeeds in compiling, go to #3.
3. Use the system() command to execute the program as in system("progname arglist") where arglist is the list of arguments to pass to the program.

This is just a general road map. Remember, the Devil's in the details... :-)

Thanks a lot,will try that for sure :D

This question has already been answered. Start a new discussion instead.