📄 char_int.c
字号:
/*
** Convert a series of digits from the standard input to an integer.
*/
#include <stdio.h>
#include <ctype.h>
int
read_int()
{
int value;
int ch;
value = 0;
/*
** Convert digits from the standard input; stop when we get a
** character that is not a digit.
*/
while( ( ch = getchar() ) != EOF && isdigit( ch ) ){
value *= 10;
value += ch - '0';
}
/*
** Push back the nondigit so we don't lose it.
*/
ungetc( ch, stdin );
return value;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -