I have two functions bool check_key(string cKey, string eKey) and bool check_digit(char digit1, char digit2), and I have declared both of them globally (is this the right terminology?) right after the "using namespace std;" and right before the "int main(){".
In the first one, I called the second one . But it is giving me the error: "no match for call to `(std::string) (int&)' ".
I am not sure how to fix this.
Code:bool check_key(string cKey, string eKey) { if(cKey!="" && eKey=="") return false; if(cKey=="" && eKey=="") return true; if(cKey=="" && eKey!="") return true; if(cKey.length()!= eKey.length()) return false; bool flag=true; bool one_digit_wrong=false; for(int i=0;i<cKey.length();i++) { if(cKey[i]!=eKey[i]) { if(!one_digit_wrong) { flag=flag && check_digit(cKey[i],eKey(i)); //ERROR OCCURS HERE one_digit_wrong=true; } else return false; } } return flag; } bool check_digit(char digit1, char digit2) { int num = atoi(&digit1); string allowed = allowed_errors[num-1]; for(int i=0; i<allowed.length();i++) { if(digit2==allowed[i]) return true; } return false; }


Reply With Quote
Bookmarks