Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151984 杨金卓 18查找该数出现的位置 C++ Compile Error 0 MS 0 KB 313 2026-04-19 13:41:49

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int x,b=0,c==0; int a[2000]; for(int i=0;i<10;i++){ cin>>a[i]; } cin>>x; for(int i=0;i<n;i++){ if(a[i]==x){ b++; break; } } for(int i=n;i>0;i--){ if(a[i]==x){ c++; break; } } cout<<b<<c; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:13: error: expected initializer before '==' token
  int x,b=0,c==0;
             ^
Main.cc:10:16: error: 'n' was not declared in this scope
  for(int i=0;i0;i--){
            ^
Main.cc:18:4: error: 'c' was not declared in this scope
    c++;
    ^
Main.cc:22:11: error: 'c' was not declared in this scope
  cout<