a program to call a simulator


Hi

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

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
Topic archived. No new replies allowed.