Hello Dibyanshu,
To put it easily, it's simply not possible.
C++/C are complied language, you can interpret them on-the-fly like it's the case for JavaScript. Moreover, it's platform dependent.
What you can do, is create your C/C++ program before hand, compile it and use exec to run it.
Or even, use the function node to "code" and make that code your msg.payload to write it in a file on wich you'll use an exec node to compile it then run it.
In other word, the function node can only be used for JavaScript.