记录详情

Compile Error

/in/foo.cc:43:2: error: 'void IntArray::j()' conflicts with a previous declaration
  }
  ^
/in/foo.cc:9:10: note: previous declaration 'int IntArray::j'
  int j = 0;
          ^
/in/foo.cc: In constructor 'IntArray::IntArray(int*, int)':
/in/foo.cc:15:4: error: 'data' was not declared in this scope
    data[i] = a[i];
    ^~~~
/in/foo.cc: In member function 'int IntArray::BinSearch(int, int, int)':
/in/foo.cc:23:7: error: 'data' was not declared in this scope
   if (data[mid] == x)
       ^~~~
/in/foo.cc:25:5: error: no post-increment operator for type
    j++;
     ^~
/in/foo.cc:28:7: error: 'data' was not declared in this scope
   if (data[mid] > x)
       ^~~~
/in/foo.cc:30:5: error: no post-increment operator for type
    j++;
     ^~
/in/foo.cc:35:5: error: no post-increment operator for type
    j++;
     ^~
/in/foo.cc: In member function 'void IntArray::j()':
/in/foo.cc:41:8: error: invalid use of non-static member function 'void IntArray::j()'
   cout << j;
   ~~~~~^~~~
/in/foo.cc:39:7: note: declared here
  void j()
       ^
/in/foo.cc:42:3: error: invalid use of member function 'void IntArray::j()' (did you forget the '()' ?)
   j = 0;
   ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:64:7: warning: unused variable 'k1' [-Wunused-variable]
   int k1 = A.BinSearch(0, n - 1, x);
       ^~
/in/foo.cc: In member function 'int IntArray::BinSearch(int, int, int)':
/in/foo.cc:38:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^

信息

递交者
类型
自测
题目
DS7-1 折半查找的查找次数
语言
C++
递交时间
2022-01-03 23:04:00
评测时间
2022-01-03 23:04:00
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes