1, develop good programming habits. For example: definition of Function name, definition of variable name and so on.
2, the use of modular ideas to design and write program code.
For example, for a program segment that implements a feature, it should be designed as a function function and then called directly where the main function is needed, thus reducing the amount of code in the main function and improving the readability of the code.
3, for the smart use of the loop, the loop output format control.
Example: Looping out line breaks or spaces
for (int i = 0;i < num;i++) {printf ("\ r \ n");//Loop output newline//or printf ("");//Loop Output spaces}
4. Use of the Sleep function
Implementation function: Execution suspend for a period of time function form: void Sleep (unsigned long); Header file: #include <windows.h>//Note: The Unit in sleep () is measured in milliseconds, so if you want the function to be stuck for 1 seconds, it should be sleep (1000);
5, C language, the control output of the line.
printf ("\ r \ n"), commonly used in Windows systems Programming: line-wrapping output, printf ("\ n"), is commonly used in Linux system programming: NewLine output.
6, Smart use of tabs, to achieve the corresponding functions.
For example, use \b tabs. Output a fallback key (that is, equivalent to pressing a backspace key on the keyboard that is the fallback key) printf ("\b");
7, C + + program, often call the system function, to implement the DOS window interface related operations.
For example, System ("CLS");/* Clear screen operation */
8. Use of the Exit function
Function: Closes all files and terminates the process being executed. In C + +, the usual form: exit (0);/* indicates normal exit, end program */equivalent to return 0;exit (1),/* indicates abnormal exit, end program */equivalent to return 1;
This article is from the "Memory Route" blog, be sure to keep this source http://zhanglives.blog.51cto.com/8762788/1856251
C Language Play Letter Small program Implementation----notes Little note