getop.c

来自「Multi-module programs and MAKE」· C语言 代码 · 共 25 行

C
25
字号
#include <stdio.h>#include <ctype.h>#include "getop.h"#include "getch.h"/* getop: get next operator or numeric operand *//* note simplification allowed for ints--no decimal point handling */int getop(char s[]){    int i=0, c;    while ((s[0] = c = getch()) == ' ' || c == '\t')	;    s[1] = '\0';    if (!isdigit(c))	return c;       /* not a number */    else 	while (isdigit(s[++i] = c = getch()))	    ;    s[i] = '\0';    if (c != EOF)	ungetch(c);    return NUMBER;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?