我为下面给出的二进制堆编写了一个程序
#include<iostream>
using namespace std;
class BinaryHeap
{
private:
int currentSize; // Number of elements in heap
int array[]; // The heap array
void buildHeap( );
void percolateDown( int hole );
public:
bool isEmpty( ) const;
bool isFull( ) const;
int findmini( ) const;
void insert( int x );
void deleteMin( );
void deleteMin( int minItem );
void makeEmpty( );
public :
BinaryHeap( int capacity )
{
array[capacity + 1];
currentSize = 0;
}
};
int main()
{
int resp, ch, choice;
int n, i;
Binaryheap b;
cout << "enter the size of heap" << endl;
cin >> n;
BinaryHeap(n);
return (0);
}
编译时出现错误 - 在我编写代码的那一行,没有在此范围内声明“binaryheap” 错误 BinaryHeap b;
的原因是什么以及如何解决?