How do I get two programs to communicate with one another? [CPP]

I am trying to make something like this, but I need the programs to communicate. One program needs to change a variable in another when a collision is detected.

Assistance would be much appreciated.