To made an application scriptable, as it's needed for controlling it via the "tell" statements, is not trivial. But there is an easy way to execute binaries via the "do shell script" command. If your binary is able to handle parameters, given on the command line, you can call it and submit the values from inside your AppleScript code:
Code:
set myCommand to "/PATH/TO/YOUR/BINARY " & "Will it work?"
do shell script (myCommand)
This assumes your code is compiled to an executable, which will be found at the proper path and will be able to handle the submitted value(s): Three strings! -- for the executing shell will separate them because of the whitespaces.
In my opinion, it's best practice to separate the command string's definition from the executing "do shell script" line, for in this case you're able to alter the string, e.g. exchanging the parameters in dependence of interactive user input.
I don't know how familiar you are with coding in C++ and handling parameters, so ask for help if needed.
Ah -- and i forgot: The Output of a called shell script will "vanish" in the deeps of the system's processes, because there is no shell window, where you can see the output. Try to catch the output instead of assigning it to a variable, you will be able to display:
Code:
set myValue to do shell script (myCommand)
display dialog myValue