void insert(const T value) { // value in heap
if (totalNr < long - 1) { // the place:
data[++totalNr] = value; // put it in the bottom. (data here pointer)
upHeap(totalNr); // upHeape
} else // no place in heap:
cout << "\nHeap is not empty " << long
<< " elements (includea. sen key)!\n\n";
}
"data" presumably has "long" possible elements. To add NEW data, you want to add it into data where there isn't already data. totalNR keeps track of the number of elements put inside of data, so you increment it to go to the next empty space in data where you can put your new information.
If you're going through the elements of the array, you are NOT inserting new data - and totalNr's job is to keep track of how many elements you've put into the array so far. To go through the array, you want a different variable - and it'll go from 0 to the value of totalNr.