#include <ctype.h>
int getch(void);
void ungetch(int);
/* getop: get next character or numeric operand */
int getop(char s[])
{
static int lastc=0;
int i, c;
if(lastc==0)
{
c=getchar();
}
else
{
c=lastc;
lastc=0;
}
while ((s[0] = c ) == ' ' || c == '\t')
c=getchar();
s[1] = '\0';
if (!isdigit(c) && c != '.')
return c; /* not a number */
i = 0;
if (isdigit(c)) /* collect integer part */
while (isdigit(s[++i] = c = getch()))
;
if (c == '.') /* collect fraction part */
while (isdigit(s[++i] = c = getch()))
;
s[i] = '\0';
if (c != EOF)
lastc=c;
return NUMBER;
}