I declare a string parameter inside of a bool function. And when I run the code build messages show me "string was not declare in the scope".
I tried it on code block ..
bool isOkay(char open,char close);
bool isCheck(string exp);
bool isCheck(string exp){
stack<char>s;
int i;
for(i=0;i<exp.length();i++){
if(exp[i] == '(' || exp[i] == '{' || exp[i] == '['){
s.push(exp[i]);
}
else if(exp[i] == ')' || exp[i] == '}' || exp[i] == ']'){
if(s.empty() || !isOkay(s.top(),exp[i])){
return false;
}
else{
s.pop();
}
}
}
return s.empty() ? true : false;
}
bool isOkay(char open , char close){
if(open == '(' && close== ')') return true;
else if(open == '{' && close== '}') return true;
else if(open == '[' && close== ']') return true;
return false;
}
The error message is "String was not declare in the scope"