Answers for "convert c++ to mips assembly code online"

C++
0

convert c++ to mips assembly code online

#include <iostream>

using namespace std;

void heapify(int arr[], int n, int i)
{
	int largest = i; 
	int l = 2 * i + 1;
	int r = 2 * i + 2; 

	if (l < n && arr[l] > arr[largest])
		largest = l;

	if (r < n && arr[r] > arr[largest])
		largest = r;

	if (largest != i) {
		swap(arr[i], arr[largest]);

		heapify(arr, n, largest);
	}
}

void deleteRoot(int arr[], int& n)
{

	int lastElement = arr[n - 1];

	
	arr[0] = lastElement;


	n = n - 1;

	heapify(arr, n, 0);
}


void printArray(int arr[], int n)
{
	for (int i = 0; i < n; ++i)
		cout << arr[i] << " ";
	cout << "\n";
}
int main()
{
	
	int arr[] = { 10, 5, 3, 2, 4 };

	int n = sizeof(arr) / sizeof(arr[0]);

	deleteRoot(arr, n);

	printArray(arr, n);

	return 0;
}
Posted by: Guest on May-04-2021
0

convert c++ to mips assembly code online

#include <stdio.h>
int main() {
int i;
int sum = 0;
for (i=0; i<=100; i++)
sum = sum + i*i;
printf("The sum from 0 to 100 is %d\n",sum);
Posted by: Guest on May-31-2021
0

convert c++ to mips assembly code online

A[i] = h + A[i]
Posted by: Guest on October-16-2021
-1

convert c++ to mips assembly code online

# Not sure what to do now? Enter your mips code here
Posted by: Guest on March-25-2021

Code answers related to "convert c++ to mips assembly code online"

Browse Popular Code Answers by Language