C++ code to program PLC