The smart contract you coded with Solidity gets compiled in Machine Language code for the EVM, the Ethereum Virtual Machine. This byte code gets injected inside the Blockchain, and you can interact with it throught transactions / calls.
Everything that is happening inside the EVM cannot access what is happening outside the EVM.
You cannot push another language code inside the Blockchain and expect it to work. If you want to achieve this, you have to code the software that will make the bridge between the C++ code and your smart contract that is on the Blockchain. But remember that as long as you cannot prove to the rest of the Blockchain the fairplay of what your C++ program achieved, the informations in you smart contract will be worth nothing. What is interesting about the EVM is that every action is happening on the Blockchain, and everyone can see what is happening.
But it all depends on what you are trying to achieve or build !