Why do I have this error in my code?
void check_letter(string letter, string entry) {
for(int i = 0; i < entry.length(); i++) {
if(entry[i] == letter) {
}
}
}
Invalid operands to binary expression ('std::basic_string<char>::value_type' (aka 'char') and 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char>>'))`
I want to check each letter in the word, so I check all letters of the word in a loop. I tried it on a array char (I made the array with individual letters from the word) and I had the same error.
Aucun commentaire:
Enregistrer un commentaire