Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  
  char data[h + 2][w + 2];
  
  for(int i = 0 ; i <= h + 1 ; i++){
    data[0][i] = ".";
    data[h + 1][i] = ".";
  }
  
  for(int i = 1 ; i <= h ; i++){
    data[i][0] = ".";
    data[i][w + 1] = ".";
    
    string temp;
    cin >> temp;
    
    for(int j = 1 ; j <= w ; j++){
      data[i][j] = temp.at(j - 1);
    }
  }
  
  for(int i = 1 ; i <= h ; i++){
    for(int j = 1 ; j <= w ; j++){
      if(data[i][j] == "."){
        char cnt = 0;
        if(data[i-1][j-1] == "#")cnt++;
        if(data[i-1][j] == "#")cnt++;
        if(data[i-1][j+1] == "#")cnt++;
        if(data[i][j-1] == "#")cnt++;
        if(data[i][j+1] == "#")cnt++;
        if(data[i+1][j-1] == "#")cnt++;
        if(data[i+1][j] == "#")cnt++;
        if(data[i+1][j+1] == "#")cnt++;
        cout << cnt;
      }else{
        cout << "#";
      }
    }
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   11 |     data[0][i] = ".";
      |                  ^~~
      |                  |
      |                  const char*
a.cc:12:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   12 |     data[h + 1][i] = ".";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:16:18: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   16 |     data[i][0] = ".";
      |                  ^~~
      |                  |
      |                  const char*
a.cc:17:22: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   17 |     data[i][w + 1] = ".";
      |                      ^~~
      |                      |
      |                      const char*
a.cc:29:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |       if(data[i][j] == "."){
      |          ~~~~~~~~~~~^~~~~~
a.cc:31:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |         if(data[i-1][j-1] == "#")cnt++;
      |            ~~~~~~~~~~~~~~~^~~~~~
a.cc:32:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |         if(data[i-1][j] == "#")cnt++;
      |            ~~~~~~~~~~~~~^~~~~~
a.cc:33:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |         if(data[i-1][j+1] == "#")cnt++;
      |            ~~~~~~~~~~~~~~~^~~~~~
a.cc:34:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |         if(data[i][j-1] == "#")cnt++;
      |            ~~~~~~~~~~~~~^~~~~~
a.cc:35:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |         if(data[i][j+1] == "#")cnt++;
      |            ~~~~~~~~~~~~~^~~~~~
a.cc:36:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   36 |         if(data[i+1][j-1] == "#")cnt++;
      |            ~~~~~~~~~~~~~~~^~~~~~
a.cc:37:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   37 |         if(data[i+1][j] == "#")cnt++;
      |            ~~~~~~~~~~~~~^~~~~~
a.cc:38:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |         if(data[i+1][j+1] == "#")cnt++;
      |            ~~~~~~~~~~~~~~~^~~~~~