Language: C++

#include <iostream>
using namespace std;

bool IsBomb(char* c)
{
  return c == '#';
}

int main()
{
  int H, W;
  cin >> H >> W;
  
  string map[H];
  for (int i = 0; i < H; ++i)
    cin >> map[i];
  
  char res[H][W];
  for (int i = 0; i < H; ++i)
  {
    for (int j = 0; j < W; ++j)
    {
      int numBomb = 0;
      if (map[i][j] == '#')
        res[i][j] = '#';
      else
      {
        if (i > 0 && j > 0) numBomb += (IsBomb(map[i-1][j-1]) ? 1 : 0);
        if (i > 0) numBomb += (IsBomb(map[i-1][j]) ? 1 : 0);
        if (i > 0 && j < W-1) numBomb += (IsBomb(map[i-1][j+1]) ? 1 : 0);
        if (j > 0) numBomb += (IsBomb(map[i][j-1]) ? 1 : 0);
        if (j < W-1) numBomb += (IsBomb(map[i][j+1]) ? 1 : 0);
        if (i < H-1 && j > 0) numBomb += (IsBomb(map[i+1][j-1]) ? 1 : 0);
        if (i < H-1) numBomb += (IsBomb(map[i+1][j]) ? 1 : 0);
        if (i < H-1 && j < W-1) numBomb += (IsBomb(map[i+1][j+1]) ? 1 : 0);
        res[i][j] = numBomb;
      }
    }
  }
  
  for (int i = 0; i < H; ++i)
  {
    for (int j = 0; j < W; ++j)
    {
      cout << res[i][j];
    }
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'bool IsBomb(char*)':
a.cc:6:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    6 |   return c == '#';
      |          ~~^~~~~~
a.cc: In function 'int main()':
a.cc:28:47: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   28 |         if (i > 0 && j > 0) numBomb += (IsBomb(map[i-1][j-1]) ? 1 : 0);
      |                                         ~~~~~~^~~~~~~~~~~~~~~
      |                                               |
      |                                               __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:29:38: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   29 |         if (i > 0) numBomb += (IsBomb(map[i-1][j]) ? 1 : 0);
      |                                ~~~~~~^~~~~~~~~~~~~
      |                                      |
      |                                      __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:30:49: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   30 |         if (i > 0 && j < W-1) numBomb += (IsBomb(map[i-1][j+1]) ? 1 : 0);
      |                                           ~~~~~~^~~~~~~~~~~~~~~
      |                                                 |
      |                                                 __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:31:38: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   31 |         if (j > 0) numBomb += (IsBomb(map[i][j-1]) ? 1 : 0);
      |                                ~~~~~~^~~~~~~~~~~~~
      |                                      |
      |                                      __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:32:40: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   32 |         if (j < W-1) numBomb += (IsBomb(map[i][j+1]) ? 1 : 0);
      |                                  ~~~~~~^~~~~~~~~~~~~
      |                                        |
      |                                        __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:33:49: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   33 |         if (i < H-1 && j > 0) numBomb += (IsBomb(map[i+1][j-1]) ? 1 : 0);
      |                                           ~~~~~~^~~~~~~~~~~~~~~
      |                                                 |
      |                                                 __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:34:40: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   34 |         if (i < H-1) numBomb += (IsBomb(map[i+1][j]) ? 1 : 0);
      |                                  ~~~~~~^~~~~~~~~~~~~
      |                                        |
      |                                        __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^
a.cc:35:51: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   35 |         if (i < H-1 && j < W-1) numBomb += (IsBomb(map[i+1][j+1]) ? 1 : 0);
      |                                             ~~~~~~^~~~~~~~~~~~~~~
      |                                                   |
      |                                                   __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:4:19: note:   initializing argument 1 of 'bool IsBomb(char*)'
    4 | bool IsBomb(char* c)
      |             ~~~~~~^