예제 #1
0
int main(){

  switch (rr) {
  case 1 : 
    opa();
    break;
  case 3 : 
    opa();
  default : 
    opc();
  }
  opb();

  return 1;
}
예제 #2
0
void hzs(char * ss)
{
    int i=0,j=0;
    char c,p;
    char s[100];
    stack_char * op = initstack_char(strlen(ss));
    push(op, '(');
    while((s[i++]=ss[j++])!='\0');
    i=j=0;
    while((c=s[i++])!='\0'&&c!='\n')
        switch (c) {
        case '0' :
        case '1' :
        case '2' :
        case '3' :
            \
        case '4' :
        case '5' :
        case '6' :
        case '7' :
            \
        case '8' :
        case '9' :
        case ' ' :
        case '.' :
            \
            ss[j++]=c;
            break;
        case '(' :
            push(op, c);
            break;
        case ')' :
            while((p=pop(op))!='(') {
                ss[j++]=' ';
                ss[j++]=p;
            }
            break;
        case '+' :
        case '-' :
        case '*' :
        case '/' :
            \
            while (opc(c, op->stack[op->sp-1])) {
                ss[j++]=' ';
                ss[j++]=pop(op);
            }
            ss[j++]=' ';
            push(op, c);
            break;
        }
    while (c=pop(op))
    {
        if(isempty(op))
            break;
        if(c!='(') {
            ss[j++]=' ';
            ss[j++]=c;
        }
    }
    freestack_char(op);
    ss[j]='\0';
}