Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the following C++ code fragment in assembly language. Use the block structured .IF and .WHILE directives. Assume that all variables are 32-bit integers. int

Implement the following C++ code fragment in assembly language. Use the block structured .IF and .WHILE directives. Assume that all variables are 32-bit integers.

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

int lower = 2;

int upper = 7;

int ArraySize = sizeof array / sizeof lower;

int index = 0;

int sum = 0;

while( index < ArraySize )

{

if( array[index] >= lower && array[index] <= upper )

{

sum += array[index];

}

index++;

}

Your assembly language program must also display as output the number of times a member of 'array' qualified for inclusion into the 'sum' and what the final value of the variable 'sum' was. (Hint: you may have to add another variable.) Use the author's procedures in the book's link library. Use only the procedures that were introduced in chapter 5.

Final code should display how many numbers were in the range in between 2 and 7 and sum of those numbers.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions