PDA

View Full Version : combining 2 source codes.


Immortal
08-28-2005, 03:39 PM
How do you combine 2 source codes?

e.g. 1 source code with cout funtions and the other with other stuff but only having 1 executable.

Game master pro
08-29-2005, 11:43 AM
Well i suppose yoru programming in C++, but i don't know C++, so i'll give you an example in C


#include <stdio.h>
#include <stdlib.h>
int stuff()
{
printf("YAY, random function\n");
}


Say that's the function you want, save it as randomness.h, now make a progeram with this


#include "randomness.h"
int main()
{
stuff();
system("pause");
return 0;
}


You'll see that #include "randomness.h" will include the file randomness.h in the current directtory of the .c file, you the main() function will just do the stuff() function and the stuff function prints "YAY, random function" to the screen so you are doing the function from another file, i think that's what you mean, if it's not, please tell me more.