Problem snack
User asbx
Submission Time 2023-11-09 15:44:16
Score 0
Max Time N/A
Max Memory N/A

Compile Error

snack.cpp: In function ‘int main()’:
snack.cpp:17:4: error: ‘else’ without a previous ‘if’
17 | else{
| ^~~~
snack.cpp:18:9: error: ‘i’ was not declared in this scope
18 | arr[i]=-2;
| ^
snack.cpp: At global scope:
snack.cpp:21:2: error: expected declaration before ‘}’ token
21 | }
| ^
snack.cpp:23:2: error: expected unqualified-id before ‘for’
23 | for(int i=0; i<x; i++){
| ^~~
snack.cpp:23:15: error: ‘i’ does not name a type
23 | for(int i=0; i<x; i++){
| ^
snack.cpp:23:20: error: ‘i’ does not name a type
23 | for(int i=0; i<x; i++){
| ^
snack.cpp:26:2: error: ‘cout’ does not name a type
26 | cout<<b;
| ^~~~
snack.cpp:27:1: error: expected declaration before ‘}’ token
27 | }
| ^