|
-
April 23rd, 2012, 06:56 PM
#1
error: no match for ' ' problem
so there is something wrong with the compatibility of my expression variable with everything im trying to use it for. Do I need to create an alias for it to use it the way im am attempting to use it? or reference it as something else?
the build messages are saying "error: no match for operator!= in 'expression.std::vector<_TP, _Alloc>...ect
I am making a program to convert a give integer expression that is in regular notation and converting it to post fix
Code:
int arithmetic_expression::inputInfix(std::string inputString)
{
std::vector<std::string> expression = parse_string(inputString);
stack<int> intStack;
int output[100];
int n = 0;
int n1;
int *o;
o = &output[0];
while(expression[n] != 0){
if(isdigit(expression[n]) || isalpha(expression[n])){
*o = expression[n];
n++;
o++;
}
if(expression[n] == '('){
intStack.push(expression[n]);
n++
}
if(expression[n] == ')'){
n1 = intStack.top();
intStack.pop();
while(n1 != '('){
*o = n1;
o++;
n1 = intStack.top();
intStack.pop();
}
n++
}
if(expression[n] == '+' || expression[n] == '-' || expression[n] == '*' || expression[n] == '/' || expression[n] == '%'){
if(intStack.empty() == true){
intStack.push(expression[n]);
}else{
n1 = intStack.top();
intStack.pop();
while(priority(n1) >= priority(expression[n]){
*o = n1;
o++;
n1 = intStack.top();
intStack.pop();
}
intStack.push(n1);
intStack.push(expression[n]);
}
n++
}
while(!intStack.empty()){
*o = intStack.top();
o++
intStack.pop()
}
*o = '\0';
int valid = createExpressionTree(expression);
if (!valid) {
topPtr = NULL;
}
return(valid);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|