Update system.cpp

Support C++/CX and native C++ through conditional compilation.  Fixed style - long lines, comma operators, long conditional.  Optimized string usage to use reference.