如果代码本来就是清楚的,则不必加注释

如果代码本来就是清楚的,则不必加注释。否则多此一举,令人厌烦。 例如 i++; // i 加 1,多余的注释

 1 #include <iostream>
 2 #include <stdio.h>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6         int c;
 7     /* Create an error by writing to standard input. */
 8     putc( 'A', stdin );
 9     if( ferror( stdin ) )
10     {
11       perror( "Write error" );
12       clearerr( stdin );
13     }
14 
15     /* See if read causes an error. */
16     printf( "Will input cause an error? " );
17     c = getc( stdin );
18     if( ferror( stdin ) )
19     {
20        perror( "Read error" );
21        clearerr( stdin );
22     }
23     return 0;
24 }
原文地址:https://www.cnblogs.com/borter/p/9413346.html