Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void) {
 int h, w;
cin >> h >> w;

 string board[50];

 for (int i = 0; i < h; ++i) cin >> board[i]; 8
 const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
 const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

 for (int i = 0; i < h; ++i) {
 for (int j = 0; j < w; ++j) {
 if (board[i][j] == ’#’) continue;

 int num = 0;
 for (int d = 0; d < 8; ++ d) {
 const int ni = i + dy[d];
 const int nj = j + dx[d];

 if(ni<0orh<=ni)continue;
 if(nj<0orw<=nj)continue;
 if (board[ni][nj] == ’#’) num++;
 }

 board[i][j] = char(num + ’0’); 
 }
 }

 for (int i = 0; i < h; ++i) cout << board[i] << endl; 
 return 0;
 }


Compiler output:
a.cc:15:21: error: extended character ’ is not valid in an identifier
   15 |  if (board[i][j] == ’#’) continue;
      |                     ^
a.cc:15:22: error: stray '#' in program
   15 |  if (board[i][j] == ’#’) continue;
      |                      ^
a.cc:15:23: error: extended character ’ is not valid in an identifier
   15 |  if (board[i][j] == ’#’) continue;
      |                       ^
a.cc:24:23: error: extended character ’ is not valid in an identifier
   24 |  if (board[ni][nj] == ’#’) num++;
      |                       ^
a.cc:24:24: error: stray '#' in program
   24 |  if (board[ni][nj] == ’#’) num++;
      |                        ^
a.cc:24:25: error: extended character ’ is not valid in an identifier
   24 |  if (board[ni][nj] == ’#’) num++;
      |                         ^
a.cc:27:27: error: extended character ’ is not valid in an identifier
   27 |  board[i][j] = char(num + ’0’);
      |                           ^
a.cc:27:27: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:9:48: error: expected ';' before 'const'
    9 |  for (int i = 0; i < h; ++i) cin >> board[i]; 8
      |                                                ^
      |                                                ;
   10 |  const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
      |  ~~~~~                                          
a.cc:15:21: error: '\U00002019' was not declared in this scope
   15 |  if (board[i][j] == ’#’) continue;
      |                     ^
a.cc:15:22: error: expected ')' before '\U00002019'
   15 |  if (board[i][j] == ’#’) continue;
      |     ~                ^~
      |                      )
a.cc:20:21: error: 'dx' was not declared in this scope; did you mean 'd'?
   20 |  const int nj = j + dx[d];
      |                     ^~
      |                     d
a.cc:22:8: error: unable to find numeric literal operator 'operator""orh'
   22 |  if(ni<0orh<=ni)continue;
      |        ^~~~
a.cc:23:8: error: unable to find numeric literal operator 'operator""orw'
   23 |  if(nj<0orw<=nj)continue;
      |        ^~~~
a.cc:24:23: error: '\U00002019' was not declared in this scope
   24 |  if (board[ni][nj] == ’#’) num++;
      |                       ^
a.cc:24:24: error: expected ')' before '\U00002019'
   24 |  if (board[ni][nj] == ’#’) num++;
      |     ~                  ^~
      |                        )
a.cc:27:27: error: '\U000020190\U00002019' was not declared in this scope
   27 |  board[i][j] = char(num + ’0’);
      |                           ^~~