Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int H, W;
  cin >> H >> W;
  string S[50];
  int x=0;
  for(int i = 0; i < H; i++){
    cin >> S[i];
  }//Sの配置完了
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(S[i][j] == '.'){
        if((0<=i-1)&&(i-1<=H-1)&&(0<=j-1)(j-1<=W-1)){
          if(S[i-1][j-1]=='#'){
          x++;
          }
        }
        if((0<=i-1)(i-1<=H-1)&&(0<=j)(j<=W-1)){
          if(S[i-1][j]=='#'){
          x++;
          }
        }
        if((0<=i-1)(i-1<=H-1)&&(0<=j+1)(j+1<=W-1)){
          if(S[i-1][j+1]=='#'){
          x++;
          }
        }
        if((0<=i)(i<=H-1)&&(0<=j-1)(j-1<=W-1)){
          if(S[i][j-1]=='#'){
          x++;
          }
        }
        if((0<=i)(i<=H-1)&&(0<=j+1)(j+1<=W-1)){
          if(S[i][j+1]=='#'){
          x++;
          }
        }
        if((0<=i+1)(i+1<=H-1)&&(0<=j-1)(j-1<=W-1)){
          if(S[i+1][j-1]=='#'){
          x++;
          }
        }
          if((0<=i+1)(i+1<=H-1)&&(0<=j)(j<=W-1)){
            if(S[i+1][j]=='#'){
          x++;
            }
        }
          if((0<=i+1)(i+1<=H-1)&&(0<=j+1)(j+1<=W-1)){
            if(S[i+1][j+1]=='#'){
          x++;
            }
        }
        S[i][j]='x';
      }
    }
  }
  for(int i = 0;i<H; i++)
  cout << S[i] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:42: error: expression cannot be used as a function
   15 |         if((0<=i-1)&&(i-1<=H-1)&&(0<=j-1)(j-1<=W-1)){
      |                                  ~~~~~~~~^~~~~~~~~~
a.cc:20:20: error: expression cannot be used as a function
   20 |         if((0<=i-1)(i-1<=H-1)&&(0<=j)(j<=W-1)){
      |            ~~~~~~~~^~~~~~~~~~
a.cc:20:38: error: expression cannot be used as a function
   20 |         if((0<=i-1)(i-1<=H-1)&&(0<=j)(j<=W-1)){
      |                                ~~~~~~^~~~~~~~
a.cc:25:20: error: expression cannot be used as a function
   25 |         if((0<=i-1)(i-1<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |            ~~~~~~~~^~~~~~~~~~
a.cc:25:40: error: expression cannot be used as a function
   25 |         if((0<=i-1)(i-1<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |                                ~~~~~~~~^~~~~~~~~~
a.cc:30:18: error: expression cannot be used as a function
   30 |         if((0<=i)(i<=H-1)&&(0<=j-1)(j-1<=W-1)){
      |            ~~~~~~^~~~~~~~
a.cc:30:36: error: expression cannot be used as a function
   30 |         if((0<=i)(i<=H-1)&&(0<=j-1)(j-1<=W-1)){
      |                            ~~~~~~~~^~~~~~~~~~
a.cc:35:18: error: expression cannot be used as a function
   35 |         if((0<=i)(i<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |            ~~~~~~^~~~~~~~
a.cc:35:36: error: expression cannot be used as a function
   35 |         if((0<=i)(i<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |                            ~~~~~~~~^~~~~~~~~~
a.cc:40:20: error: expression cannot be used as a function
   40 |         if((0<=i+1)(i+1<=H-1)&&(0<=j-1)(j-1<=W-1)){
      |            ~~~~~~~~^~~~~~~~~~
a.cc:40:40: error: expression cannot be used as a function
   40 |         if((0<=i+1)(i+1<=H-1)&&(0<=j-1)(j-1<=W-1)){
      |                                ~~~~~~~~^~~~~~~~~~
a.cc:45:22: error: expression cannot be used as a function
   45 |           if((0<=i+1)(i+1<=H-1)&&(0<=j)(j<=W-1)){
      |              ~~~~~~~~^~~~~~~~~~
a.cc:45:40: error: expression cannot be used as a function
   45 |           if((0<=i+1)(i+1<=H-1)&&(0<=j)(j<=W-1)){
      |                                  ~~~~~~^~~~~~~~
a.cc:50:22: error: expression cannot be used as a function
   50 |           if((0<=i+1)(i+1<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |              ~~~~~~~~^~~~~~~~~~
a.cc:50:42: error: expression cannot be used as a function
   50 |           if((0<=i+1)(i+1<=H-1)&&(0<=j+1)(j+1<=W-1)){
      |                                  ~~~~~~~~^~~~~~~~~~