From C + + programming language 1.6.1 translation is not good please advise
For C Programmer's advice
The more familiar a person is with C, the more difficult it is to avoid writing C + + programs. As a result, some of the potential benefits of C + + are lost. See Appendix B, which describes the differences between C and C + +. Here are a few of the programs that use C + + mode better than the C program model.
1. Macros are never necessary in C + +, use const or enum to define static variables, use inline to avoid function call overhead, template to point to function and type family, namespace avoid naming conflicts.
2. Do not declare it before using a variable (translator, do not declare in advance, when to use when to declare, and immediately initialize). The declaration should be in any place (translator, compared to c), included in the for and if conditions.
3. Don't use the malloc (), the new operator to do the same thing, and do it better. Instead of realloc (), you can try vectors.
4. Try to avoid void*, pointer algorithms (pointer arithmetic), union (Union) and styling (cast is type conversion). In most cases modelling is the performance of faulty design. If you have to force type conversions, try "new casts" because you're doing it in a more precise state.
5. By reducing the use of character arrays in C mode, the C + + standard class library provides string and vector classes that simplify programs (compared to traditional C schemas) and, in general, do not write your own programs to implement functionality already in the standard library.
To accommodate C's join custom, C + + functions must be declared as C join mode.
Most importantly, try to see a program as an interaction concept (translator: Member and method). and is displayed as classes and instances rather than as a bunch of data structures manipulated by functions.