代码:
// fgets2.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <stdio.h> #include <string.h> #include <stdlib.h> typedef enum{ TT_NUM, TT_ADD, TT_SUB, TT_MUL, TT_DIV, TT_LP, TT_RP, TT_EOL }TokenType; typedef struct{ TokenType type; char text[255]; }Token; static int pos=0; static char* line; static Token prevToken; static int prevTokenExist; void getToken(Token *token){ char arr[255]; int index=0; arr[index]='