0

I'm working on a program using heaps and I have a few errors that I can't quite figure out.

The first is error C2143: syntax error : missing ';' before 'using' line 2

and the second is error C2011: 'Heap' : 'class' type redefinition line 8

```
#include <iostream>
using namespace std;
#define MAX_SIZE 1000
//Heap Class
class Heap
{
public:
Heap() // constructor
{
size=0;
}
void insertItem(int newItem) // insert a value into Heap
{
item[size]= newItem;
int child=size;
int parent=(child - 1)/2;
while(parent >= 0 && item[child] > item[parent])
{
//swap child and parent
child = parent;
parent=(child - 1)/2;
}
size++;
}
void deleteItem(int &item) // delete the root item in Heap
{
if(size > 0)
{
int start = 0;
item[&start]=item[&size-1];
heapRebuild(0);
size--;
}
}
void heapRebuild(int parent) // convert the semiheap into a heap
{
int child = 2 * parent + 1;
int start=0;
if(child < size)
{
int rightChild = child + 1;
if( rightChild > size && item[start] > item[child])
{
child=rightChild;
}
if(item[parent] < item[child])
{
int temp = item[parent];
item[parent] = item[child];
item[child]=temp;
}
}
}
bool isEmpty() // check it is empty or not
{
if(size>0)
return false;
else
return true;
}
private:
int item[MAX_SIZE]; // the array holding the items in the heap
int size; // the number of items in the heap
}
```

it also gives me: IntelliSense: expected a ';' for line 3

```
#include "Heap.h";
void HeapSort(int numbers[], int size)
{
int i, temp;
for (i = (size / 2)-1; i >= 0; i--)
siftDown(numbers, i, size);
for (i = size-1; i >= 1; i--)
{
temp = numbers[0];
numbers[0] = numbers[i];
numbers[i] = temp;
siftDown(numbers, 0, i-1);
}
}
void siftDown(int numbers[], int root, int bottom)
{
int done=0, maxChild=0, temp;
while (root*2 <= bottom && done!=1)
{
if (root*2 == bottom)
maxChild = root * 2;
else if (numbers[root * 2] > numbers[root * 2 + 1])
maxChild = root * 2;
else
maxChild = root * 2 + 1;
if (numbers[root] < numbers[maxChild])
{
temp = numbers[root];
numbers[root] = numbers[maxChild];
numbers[maxChild] = temp;
root = maxChild;
}
else
done = 1;
}
}
```