如果代码本来就是清楚的,则不必加注释。否则多此一举,令人厌烦。 例如 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 }

 

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2022-02-08
  • 2021-06-22
  • 2021-10-05
  • 2021-12-18
  • 2021-10-27
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-11-21
相关资源
相似解决方案