Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    int c = (10 * (a + b)) / 2;
    string s = to_string(c);
    if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
        s[s.size() - 1] = 0;
    } else {
        s[s.size() - 1] = 0;
        int x = s[s.size() - 2] - '0';
        if(x == 9){
           int y = s[s.size() - 3] - '0';
           y += 1;
           x = 0;
           s[s.size() - 3] = to_string(y);
           s[s.size() - 2] = to_string(x);
        } else {
            x += 1;
            s[s.size() - 2] = to_string(x);
        }
    }
    int ans = stoi(s);
    ans /= 10;
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
    8 |     if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
      |        ~~~~~~ ^~ ~~~
      |          |       |
      |          |       char
      |          <unresolved overloaded function type>
a.cc:8:32: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
    8 |     if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
      |                         ~~~~~~ ^~ ~~~
      |                           |       |
      |                           |       char
      |                           <unresolved overloaded function type>
a.cc:8:49: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
    8 |     if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
      |                                          ~~~~~~ ^~ ~~~
      |                                            |       |
      |                                            |       char
      |                                            <unresolved overloaded function type>
a.cc:8:66: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
    8 |     if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
      |                                                           ~~~~~~ ^~ ~~~
      |                                                             |       |
      |                                                             |       char
      |                                                             <unresolved overloaded function type>
a.cc:8:83: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
    8 |     if(s.back == '0' && s.back == '1' && s.back == '2' && s.back == '3' && s.back == '4'){
      |                                                                            ~~~~~~ ^~ ~~~
      |                                                                              |       |
      |                                                                              |       char
      |                                                                              <unresolved overloaded function type>
a.cc:17:39: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   17 |            s[s.size() - 3] = to_string(y);
      |                              ~~~~~~~~~^~~
      |                                       |
      |                                       std::string {aka std::__cxx11::basic_string<char>}
a.cc:18:39: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   18 |            s[s.size() - 2] = to_string(x);
      |                              ~~~~~~~~~^~~
      |                                       |
      |                                       std::string {aka std::__cxx11::basic_string<char>}
a.cc:21:40: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   21 |             s[s.size() - 2] = to_string(x);
      |                               ~~~~~~~~~^~~
      |                                        |
      |                                        std::string {aka std::__cxx11::basic_string<char>}