📄 number.c
字号:
/*
** Copy the standard input to the standard output, and number the
** output lines.
*/
#include <stdio.h>
#include <stdlib.h>
int
main()
{
int ch;
int line;
int at_beginning;
line = 0;
at_beginning = 1;
/*
** Read characters and process them one by one.
*/
while( (ch = getchar()) != EOF ){
/*
** If we're at the beginning of a line, print the
** line number.
*/
if( at_beginning == 1 ){
at_beginning = 0;
line += 1;
printf( "%d ", line );
}
/*
** Print the character, and check for end of line.
*/
putchar( ch );
if( ch == '\n' )
at_beginning = 1;
}
return EXIT_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -