I believe you, then, by the momment, the code do the same as "ver" dos command, isnt it?
Im not a C++ programmer, in fact im only a fucking newbie! Feel free to kick my ass in any momment! :(
Sorry, if I understand you (my understanding is a bit limmited due im not english speaker but spanish), you ask for the purpose of the needing of this program... As I far I can get, the needing of the program itself will be to do easier and faster the need of testing the OS installed, because it will determine some different behaviours of the payload.
The need of the detection of version language installed will be to do more effective the payload against any system, because the paths of certain programs vary depending of it.
Have I answered your question? don`t worry... kick it!