Find MAX/MIN values in an array using assembly functions that are callable from
ID: 3598388 • Letter: F
Question
Find MAX/MIN values in an array using assembly functions that are callable from C++(assembly code should go in one file and get call from .cpp file)
This is what I have done, but it doesn't work when I try to run it. Please help me to figure what I did wrong. Explain and show your work. Thank you
Write a C++ program that does the following:
1) Declare an array of integers (size is your choice)--your program should work with any array size.
2) Call an assembly function to compute the largest (max) of all elements in the array (pass the array and the size of the array). Need to search for the largest value in the array(.asm) and display(.cppp)
3) call an assembly function to compute the smallest (min) of all elements in the array (pass the array and the size of the array)
Explanation / Answer
maxValue = function (array) {
m = array[0];
for (i=0; i<array.length; i++) {
if (array[i]>m) {
m = array[i];
}
}
return m;
};
minValue = function (array) {
m = array[0];
for (i=0; i<array.length; i++) {
if (array[i]<m) {
m = array[i];
}
}
return m;
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.