putting code in other files...
Code:
//bass.h
#ifndef BASS_H
#define BASS_H
void bass1 ();
void bass2 ();
#endif
-----------------------------------------------------
//bass01.cpp
#include <iostream.h>
#include "bass.h"
void bass1()
{
cout<<"Going to bass 2"<<endl;
bass2();
}
void bass2()
{
cout<<"Going back to bass 1"<<endl;
bass1();
}
-----------------------------------------------------
//main.cpp
#include <iosteream.h>
#include "bass.h"
int main()
{
bass1();
return 0;
}
The first file bass.h is the header file containing the prototype declarations of the functions. The second file bass01.cpp contains the code for bass1() and bass2() and has bass.h included in " "s because " " means the header file is in the same directory as the file its included in. Then in main.cpp it just calls bass1() like it was in the same file. Now just include bass01.cpp and main.cpp in your project in your compiler and bam.