cout<<\sentence.\
return -1; } }
char getraw_content(string str) {
if(str==\return '1'; else if(str==\return '2'; else if(str==\return '3'; else if(str==\return '4'; else if(str==\return 'c'; else if(str==\return 'd'; else if(str==\return 'e'; else if(str==\return 'f'; else if(str==\
return 'g'; else if(str==\return 'h'; 第6页 共16页 else if(str==\return 'i'; }
string get_tx(int num) {
switch(num) { case 1: return \case 2: return \case 3: return \case 4: return \case 5: return \case 6: return \case 7: return \
case 8: return \case 9: return \case 10: return \case 11: return \case 12: return \case 13: return \case 14: return \case 15: return \case 16: return \
//......本程序暂时用到这么多,等有时间编写合适的可以将数字转换为字符串的函数时,即
可更改本函数 } }
第7页 共16页
void show(char str[size],int index) { int length=getLength(str); if(index!=-1) cout<<\
for(int i=index+1;i void showc(char_stack str[size],int index) { int length=getLengthc(str); if(index!=-1) cout<<\ for(int i=index+1;i void switch_method(char_stack *stack,int *pointer,char *state_stack,int *pointer_state,string production,char *str,int *index) { step++; cout<<\显示步骤 show(state_stack,-1);//显示状态栈 cout<<\ showc(stack,-1);//显示符号站 cout<<\显示当前字符 show(str,(*index));//显示输入串 char c=str[(*index)]; if(production==\{ cout<<\sentence.\ return ; } else if(production==\{ char sx='5'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); } else if(production==\{ char sx='6'; (*index)++; pushstack(stack,pointer,state_stack,pointer_state,c,sx,0); 第8页 共16页 } else if(production==\{ char sx='7';