a program to call a simulator

Jul 15, 2012 at 1:12am

Hi

i need to write a program (in C++) to call a simulator in a another .cpp file. how iam gonna do this?

Jul 15, 2012 at 3:37am
If you are talking about function calls you could do this. Include the header file that contains the function prototype in the the .cpp file which you call the simulator in.


simulator.h
---------------
1
2
3
4
5
6
7
#ifndef SIMULATOR_H_
#define SIMULATOR_H_

// prototype for the simulator function
void simulator(int argurment1, int argurment2);

#endif 


simulator.cpp
------------------
1
2
3
4
5
6
7
8
// include the header file that contains the prototype
#include "simulator.h" 

// definition for simulator function
void simulator(int argurment1, int argurment2)
{
//Do somethings...
}


main.cpp
-------------
1
2
3
4
5
#include "simulator.h"
{
// call to simulator
simulator();
}


compiling: g++ simulator.cpp main.cpp -o simulator
Last edited on Jul 15, 2012 at 3:39am
Topic archived. No new replies allowed.