#include"stdlib.h" 
main()
{
    int i,j,s;
    char a[20],b[10],c[10];
    scanf("%s",a);
    for(i=0,j=0;i<20&&a[i]!='\0';i++,j++)//把括号里的先算出。
    {
        if(a[i]=='(')
        { 
            if(a[i+2]=='+')
                s=a[i+1]+a[i+3];
            else if(a[i+2]=='-')
                s=a[i+1]-a[i+3];
            b[j]=s;i=i+4;
        }
        else b[j]=a[i];
    }
    for(i=0,j=0;b[i]!='\0';i++)//算出积或商。
    {  
        if(b[i]=='*')
        {    s=b[i-1]*b[i+1];c[j]=s; i=i+1;j++;}
        else if(b[i]=='/')
        {    s=b[i-1]/b[i+1];c[j]=s; i=i+1;j++;}
        else if(b[i]=='+'||b[i]=='-') {c[j]=b[i]; j++;}
        else continue;
    }
     for(i=0;c[i]!='\0';i++)
     {
             if(c[i]=='+')
                s=c[i-1]+c[i+1];
            else if(c[i]=='-')
              s=c[i-1]-c[i+1];
     }
     printf("%d",s);
}
求(5+5)*2-(6+6)/2 不对

帮找下错