Comparing characters at the same index of two strings
Advertisements I am trying to compare the characters of two strings at a given index. However, I am getting the following error: Line 9: Char 26: error: invalid operands to binary expression (‘const __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ (aka ‘const char’) and ‘const std::__cxx11::basic_string<char>’) if (s[i] != letter) { return s.substr(0, i); } ~~~~ ^ ~~~~~~ Here is… Read More Comparing characters at the same index of two strings