Compile Error

/in/foo.cc: In function 'int binary_sreach(int*, int, int, int)':
/in/foo.cc:11:3: error: expected ',' or ';' before 'if'
   if(a[mid]<key)
   ^~
/in/foo.cc:10:7: warning: unused variable 'mid' [-Wunused-variable]
   int mid=(start+end)/2
       ^~~
/in/foo.cc:15:3: error: expected '}' before 'else'
   else if(a[mid]<key)
   ^~~~
/in/foo.cc:15:13: error: 'mid' was not declared in this scope
   else if(a[mid]<key)
             ^~~
/in/foo.cc:17:27: error: expected primary-expression before ']' token
    return binary_sreach(a[],start,mid-1,key);
                           ^
/in/foo.cc: At global scope:
/in/foo.cc:24:2: error: expected unqualified-id before 'else'
  else
  ^~~~
/in/foo.cc:28:1: error: expected declaration before '}' token
 }
 ^

信息

递交者
类型
递交
题目
P1168 折半查找
语言
C++
递交时间
2021-12-14 21:03:37
评测时间
2021-12-14 22:00:51
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes