#include #include int main() { char string[100];// = {'\0'}; int val; char c = getchar(); int i; while(1) { i = -1; while (isspace(c) == 0) { i ++; string[i] = c; c = getchar(); } string[i+1] = '\0'; val=yylex(string); while(val >= 1) { if (val == 256) {printf("%s Number\n", string);break;} else if (val == 257) {printf("%s Invalid\n", string); break;} else if (val == 42) {printf("%c Operator\n", val); break;} else if (val == 43) {printf("%c Operator\n", val); break;} else if (val == 45) {printf("%c Operator\n", val); break;} else if (val == 47) {printf("%c Operator\n", val); break;} else if (val == 61) {printf("%c Operator\n", val); break;} } c = getchar(); } return 0; } int yylex(char * temp) { char check[50]; float num; check[0]='\0'; if(strlen(temp)==1) { if(temp[0]=='+' ||temp[0]=='*' || temp[0]=='-'|| temp[0]== ='/' || temp[0]=='=') {return temp[0];} if (isdigit(temp[0])) {return 256;} if (isalpha(temp[0])) {return 257;} } if(sscanf(temp, "%f%s", &num, check)==2 && strlen(check)>0) {return 257;} else if(sscanf(temp, "%f%s", &num, check)==1 && strlen(check)==0) {return 256;} return 257; }