write a program using heaps in c++ oop too?
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
#include <iostream>
using namespace std;
void max_heap(int *a, int m, int n) {
int j, t;
t = a[m];
j = 2 * m;
while (j <= n) {
if (j < n && a[j+1] > a[j])
j = j + 1;
if (t > a[j])
break;
else if (t <= a[j]) {
a[j / 2] = a[j];
j = 2 * j;
}
}
a[j/2] = t;
return;
}
void build_maxheap(int *a,int n) {
int k;
for(k = n/2; k >= 1; k--) {
max_heap(a,k,n);
}
}
int main() {
int n, i;
cout<<"enter no of elements of array\n";
cin>>n;
int a[30];
for (i = 1; i <= n; i++) {
cout<<"enter elements"<<" "<<(i)<<endl;
cin>>a[i];
}
build_maxheap(a,n);
cout<<"Max Heap\n";
for (i = 1; i <= n; i++) {
cout<<a[i]<<endl;
}
}

Kindly revert for any queries
Thanks.
.Using OOP, write a C++ program that will read in a file of names. The file is called Names.txt and should be located in the current directory of your program. Read in and store the names into an array of 30 names. Sort the array using the selection sort or the bubblesort code found in your textbook. List the roster of students in ascending alphabetical order. Projects using global variables or not using a class and object will result in...
Write a program using OOP to contain the following methods. Use proper constructor and instantine different object to use the specified ,methods. The program must be interactive. A method called “displayCourse” which displays the name of CS courses offered in Loudoun. (CS200..) Set Coursename() Display Course time() Display Course name()\ HInt: Course info a=new courseInfo() a.displayCourseTime(name, …) Course name - CSC 200 , time 9;30 am CSC 201 time : 9:30 am
i need this to be in OOP using C++
25. Savings Account Balance Write a program that calculates the balance of a savings account at the end of a three-month feried. It should ask the user for the starting balance and the annual interest rate. A loop abculd then iterate once for every month in the period, performing the following steps: B) A) Ask the user for the total amount deposited into the account during that month and add it...
Write a C+OOP program that simulates a vending machine. The program should define at least two classes. Less than two classes will result in 20 points deduction. (30 points) One must be general vending machine (50 points) The other can be either vending machine of soda, or vending machine of snack. It must be a subclass of above general machine These vending machines should have following components and functions e Coin slot o Allow adding coins o Display total coin...
write code to demonstrate the features of oop use C# programming.
PlLEASE HELP !! Python II final project. Object Oriented Programming python.Make a program using OOP concepts. Anything will work as long as it runs in idle.
Write a Java program that prompts user to calculate area of five different shapes using java library, and at least 2 classes - more of OOP, also use divide and conquer methods.
To be done in Java OOP Write a program that teaches arithmetic to a young child. The program tests addition and subtraction. In Level 1, it tests only addition of whole numbers less than ten whose sum is less than ten. In level 2, it tests addition of arbitrary single digit whole numbers. In level 3, it tests subtraction of single digit whole numbers with a non-negative difference. Generate random problems and get the players' input. The player gets up...
Define a problem utilizing an efficient sorting algorithm please write code in c++ oop thnx?
In Java Write a program the takes in a number and converts it to binary. Use an OOP class approach using class and objects