Something like this:
Code:

#include <algorithm>

int main()
{
const int capacity = 11;
int a[capacity] = {1, 2, 3, 4, 5, 6, 7};
int size = 7;
std::make_heap(a, a + size);

// Add 50 to the heap:
a[size++] = 50;
std:ush_heap(a, a + size);

return 0;
}
hmm why did you do "a+size" ?


How about this? does it seem right?

Code:
 #include <iostream>
    #include <algorithm>

    void heap_sort(int* begin, int* end)
    {
    std::make_heap(begin, end);
    std::sort_heap(begin, end);
    }

    int main ()
    {
      const int n = 11;   
      int a[n] = {1, 2, 3, 4, 5, 6, 7};
      int size = 7;
    
    heap_sort( &a[0], &a[size]);

    // Add 50 to the heap:
    a[size++] = 50;
    std::push_heap(&a[size], &a[n]);


    return 0;
    }
thanks a lot for responding