krx41100.c
来自「answer of the c programming language sec」· C语言 代码 · 共 34 行
C
34 行
#include <stdio.h>
#define NUMBER '0'
int getop(char *s)
{
int c;
static int buf = EOF;
if (buf != EOF && buf != ' ' && buf != '\t'
&& !isdigit(buf) && buf != '.') {
c = buf;
buf = EOF;
return c;
}
if (buf == EOF || buf == ' ' || buf == '\t')
while ((*s = c = getch()) == ' ' || c == '\t')
;
else
*s = c = buf;
buf = EOF;
*(s + 1) = '\0';
if (!isdigit(c) && c != '.')
return c; /* not a number */
if (isdigit(c)) /* collect integer part */
while (isdigit(*++s = c = getch()))
;
if (c == '.') /* collect fraction part */
while (isdigit(*++s = c = getch()))
;
*++s = '\0';
buf = c;
return NUMBER;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?