If I had two source files main_1.cpp and main_2.cpp would I be able to call functions defined in main_1 inside of main_2 or why would I use two I read something somewhere its better orgination but I'm not sure exactly.
If I had two source files main_1.cpp and main_2.cpp would I be able to call functions defined in main_1 inside of main_2 or why would I use two I read something somewhere its better orgination but I'm not sure exactly.
+++
++
+ Sekti
++
+++
you sure can...
just remember that you can only have one function named main..
check out this sample.....
//-------------------------
//main1.h
#ifndef MAIN1_H
#define MAIN1_H
int multiply(int x, int y);
int addex(int x, int y);
#endif
////end of main1
//--------------------------
//main1.cpp
#include "main1.h"
#include "main2.h"
int multiply(int x, int y)
{
return x * y;
}
int addex( int x, int y)
{
return add( x, y);
}
//-------------------------main2.h
#ifndef MAIN2_H
#define MAIN2_H
int add(int x, int y);
#endif
/////end of main2
//---------------------------
//main2.cpp
#include "main2.h"
int add(int x, int y)
{
return x + y;
}