Code examples help users do their own work because users can copy the example and adapt it to their needs.
Examples in software information often contain code and commands. A C++ routine does not describe C++ code; it is C++ code for a particular purpose. When describing the C++ language, a good writer uses examples of C++ code.