1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

non pod error

Discussion in 'C++' started by jibrownie, Oct 5, 2010.

  1. jibrownie

    jibrownie New Member

    Joined:
    Oct 5, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    please help, the program converts polish notation to reverse polish notation yet when i try to print out any of the elements of string bits or equat it gives me an error
    Code:
    using namespace std;
    string equat, StringBits[26], hold, str;
    char c = 'a', oc;
    int i;
    
    int main(int argc, char *argv[])
    {
            scanf("%s", &equat);
    
    while (equat.length() > 1){
        StringBits[c] = equat.substr(equat.find_last_of('-','+'),3);
        hold = StringBits[c].substr(0,1);
        StringBits[c].erase(0);
            StringBits[c].append(hold);
            str = c;
        equat.replace(equat.find_last_of('-','+'),3,str);
        c++;
              }
    
     for (oc = 'z'; oc >= 'a'; oc--){
            str = oc;
             equat.replace(equat.find(str),1,StringBits[oc]);
    }
        printf("%s", equat);
        system("PAUSE");
        return EXIT_SUCCESS;
    }
     

Share This Page