1: //is_heap1a.cpp 3: #include <iostream> 4: #include <iomanip> 5: #include <vector> 6: #include <algorithm> 7: using namespace std; 9: int main() 10: { 11: cout << "\nThis program illustrates the use of the STL " 12: "is_heap() algorithm from\n<algorithm> to test whether " 13: "a vector of integers is a (default) maximum heap."; 14: cout << "\nPress Enter to continue ... "; cin.ignore(80, '\n'); 16: int a[] = {17, 12, 15, 9, 6, 14, 8, 3, 5}; 17: int b[] = {17, 12, 15, 9, 14, 6, 8, 3, 5}; 18: vector<int> va(a, a+9); 19: vector<int> vb(b, b+9); 20: cout << boolalpha; 21: cout << is_heap(va.begin(), va.end()) << endl; 22: cout << is_heap(vb.begin(), vb.end()) << endl; 23: cout << "Press Enter to continue ... "; cin.ignore(80, '\n'); 24: }