Compile Error

foo.cc: In function 'int main()':
foo.cc:18:17: error: 'else' without a previous 'if'
   18 |                 else
      |                 ^~~~
foo.cc:6:24: warning: unused variable 'b' [-Wunused-variable]
    6 |         int a[100]={0},b[100]={0};
      |                        ^
foo.cc:7:13: warning: unused variable 'm' [-Wunused-variable]
    7 |   int n,j=0,m=0,i,max;
      |             ^
foo.cc:7:19: warning: unused variable 'max' [-Wunused-variable]
    7 |   int n,j=0,m=0,i,max;
      |                   ^~~
foo.cc: At global scope:
foo.cc:22:9: error: 'a' does not name a type
   22 |         a[j]=n;
      |         ^
foo.cc:23:5: error: expected unqualified-id before 'for'
   23 |     for (int x = 0; x <=j; x++)
      |     ^~~
foo.cc:23:21: error: 'x' does not name a type
   23 |     for (int x = 0; x <=j; x++)
      |                     ^
foo.cc:23:28: error: 'x' does not name a type
   23 |     for (int x = 0; x <=j; x++)
      |                            ^
foo.cc:37:5: error: 'cout' does not name a type
   37 |     cout<<m<<endl;
      |     ^~~~
foo.cc:38:2: error: expected unqualified-id before 'for'
   38 |  for (int i = 0; i < m; i++)
      |  ^~~
foo.cc:38:18: error: 'i' does not name a type
   38 |  for (int i = 0; i < m; i++)
      |                  ^
foo.cc:38:25: error: 'i' does not name a type
   38 |  for (int i = 0; i < m; i++)
      |                         ^
foo.cc:42:5: error: expected unqualified-id before 'return'
   42 |     return 0;
      |     ^~~~~~
foo.cc:43:5: error: expected declaration before '}' token
   43 |     }
      |     ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1118 找满足条件的素数(3)
语言
C++
递交时间
2021-12-11 13:27:34
评测时间
2021-12-11 13:27:34
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes