#include#include int i,j=1;char N[100];void A();void A1();void B();void B1();void C();void A(){B();A1();}void B(){C();B1();}void A1(){if(N[i]=='+'||N[i]=='-'){i++;B();A1();}else if(N[i]=='#'||N[i]==')'){i++;}}void B1(){if(N[i]=='*'||N[i]=='/'){i++;C();B1();}else if(N[i]=='#'||N[i]==')'){i++;}}void C(){int d;if((N[i]<='z'&&N[i]>='a')||(N[i]<='Z'&&N[i]>='A')){if((N[i++]<='z'&&N[i++]>='a')||(N[i++]<='Z'&&N[i++]>='A'))i++;else {printf("\n分析失败!\n");j=0;}}if(N[i]<='9'&&N[i]>='0'){if(N[i++]<='9'&&N[i++]>='0')i++;else {printf("\n分析失败!\n");j=0;}}else if(N[i]=='('){A();if(N[i]==')'){i++;}else{ printf("\n分析失败!\n");exit (0);}}else{ printf("\n分析失败!\n");exit (0);}}int main(){int len,d;start:printf("请输入表达式:\n");scanf("%s",N);len=strlen(N);N[len]='#';N[len+1]='\0';E();if(J==1){printf("是否为正确的表达式\n");}printf("是否重试?重试输入1:");scanf("%d",&d);if(d=1)goto start;return 0;