Question: one-dimension array processing algorithms Find the maximal value use it with the given code below: Replace this template with your solutions (comments are welcome): #include

one-dimension array processing algorithms

Find the maximal value use it with the given code below:

Replace this template with your solutions (comments are welcome):

#include "stdafx.h"

#include

#include

// :::

// For each grade level variant implement own function, e.g.:

int solution_for_grade_6(const int arr[], size_t arr_size)

{

int result = 0;

__asm

{

// Find maximal value code using Inline Assembler instructions go here

// :::

mov [result], eax ; saves the result

}

return result;

}

// :::

int main()

{

int test_result;

// Change the element count and values according to your algorithm needs:

int test_arr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

test_result = solution_for_grade_6(test_arr1, sizeof(test_arr1)/sizeof(test_arr1[0]));

// You can use assert() function to test for correctness:

assert(expected_result == test_result);

// Or print the results to console:

printf("Grade 6 result1 = %d ", test_result);

// For the same grade level function you might use different input arrays,

// e.g. to test for side cases:

int test_arr2[] = { 0, -1, 2, -3, 4, -5, 6, -7, 8, -9 };

test_result = solution_for_grade_6(test_arr2, sizeof(test_arr2)/sizeof(test_arr2[0]));

assert(another_expected_result == test_result);

// Or print the results to console:

printf("Grade 6 result2 = %d ", test_result);

// :::

getchar(); // Wait for the Enter key

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!