这个编译错误是为啥
  • 板块灌水区
  • 楼主liuergou
  • 当前回复7
  • 已保存回复7
  • 发布时间2023/10/4 22:03
  • 上次更新2023/11/2 15:39:22
查看原帖
这个编译错误是为啥
722656
liuergou楼主2023/10/4 22:03
#include <bits/stdc++.h>
using namespace std;
int xl,xr,yu,yd;
int f[110][110],x,y,l[110][110];
int n,m,xx,yy;
int main();
    cin >> n >> m >> xx >> yy;
    for(int i=1;i<=xx;i++){
        cin >> xl >> yu >> xr >> yd;
        for(int j=xl;j<=xr;j++){
            for(int k=yl;k<=yr;k++){
                f[j][k]++;
                l[j][k]=i;
            }
        }
    }
    for(int i=1;i<=yy;i++){
        cin >> x >> y;
        if(f[x][y]){
            cout << "Y " << f[x][y] << " " << l[x][y] << endl;
        }
        else cout << "N" << endl;
    }
    return 0;
}

这是为啥
/tmp/compiler_i56xx3rt/src:7:5: 错误:‘cin’不是一个类型名
    7 |     cin >> n >> m >> xx >> yy;
      |     ^~~
/tmp/compiler_i56xx3rt/src:8:5: 错误:expected unqualified-id before ‘for’
    8 |     for(int i=1;i<=xx;i++){
      |     ^~~
/tmp/compiler_i56xx3rt/src:8:17: 错误:‘i’不是一个类型名
    8 |     for(int i=1;i<=xx;i++){
      |                 ^
/tmp/compiler_i56xx3rt/src:8:23: 错误:‘i’不是一个类型名
    8 |     for(int i=1;i<=xx;i++){
      |                       ^
/tmp/compiler_i56xx3rt/src:17:5: 错误:expected unqualified-id before ‘for’
   17 |     for(int i=1;i<=yy;i++){
      |     ^~~
/tmp/compiler_i56xx3rt/src:17:17: 错误:‘i’不是一个类型名
   17 |     for(int i=1;i<=yy;i++){
      |                 ^
/tmp/compiler_i56xx3rt/src:17:23: 错误:‘i’不是一个类型名
   17 |     for(int i=1;i<=yy;i++){
      |                       ^
/tmp/compiler_i56xx3rt/src:24:5: 错误:expected unqualified-id before ‘return’
   24 |     return 0;
      |     ^~~~~~
/tmp/compiler_i56xx3rt/src:25:1: 错误:expected declaration before ‘}’ token
   25 | }
      | ^

2023/10/4 22:03
加载中...