Compile Error

foo.cc: In function ‘int main()’:
foo.cc:13:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   13 |         if(n>=k)cout<<n-k;return 0;
      |         ^~
foo.cc:13:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   13 |         if(n>=k)cout<<n-k;return 0;
      |                           ^~~~~~
foo.cc:20:17: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   20 |                 for(int i=1,nx;i<=3;i++)
      |                 ^~~
foo.cc:22:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   22 |                         if(i==2)nx=x-1;
      |                         ^~
foo.cc:20:29: warning: variable ‘nx’ set but not used [-Wunused-but-set-variable]
   20 |                 for(int i=1,nx;i<=3;i++)
      |                             ^~
foo.cc:22:28: error: ‘i’ was not declared in this scope
   22 |                         if(i==2)nx=x-1;
      |                            ^
foo.cc:22:33: error: ‘nx’ was not declared in this scope; did you mean ‘x’?
   22 |                         if(i==2)nx=x-1;
      |                                 ^~
      |                                 x
foo.cc:23:28: error: ‘i’ was not declared in this scope
   23 |                         if(i==3)nx=x*2;
      |                            ^
foo.cc:23:33: error: ‘nx’ was not declared in this scope; did you mean ‘x’?
   23 |                         if(i==3)nx=x*2;
      |                                 ^~
      |                                 x
foo.cc:24:28: error: ‘nx’ was not declared in this scope; did you mean ‘x’?
   24 |                         if(nx>=0&&nx<=100000&&!vis[nx])
      |                            ^~
      |                            x

信息

递交者
类型
递交
题目
P1018 抓牛(catchcow)
语言
C++
递交时间
2025-07-22 15:55:27
评测时间
2025-07-22 15:55:27
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes