In assembly language 8086 using kip irvine....A sequence of numbers is an ordere
ID: 672706 • Letter: I
Question
In assembly language 8086 using kip irvine....A sequence of numbers is an ordered list of numbers that follow a certain rule. For example, the positive integers start at 1 and each one is found by adding a 1 to the previous number. Mathematically, this can be written in a recurrent form as yk = yk-1 + 1 which means, the current number is the previous number plus one, and the sequence looks like this: { 1,2,3,4,5,6,7,8,9, etc. }. Another example is the Fibonacci numbers. Their mathematical form is yk = yk-2 + yk-1 which means, the current number is the sum of the previous 2 numbers. The first two numbers are 0 and 1, and the sequence looks like this: { 0,1,1,2,3,5,8,13, etc. }. There are many sequences that can be defined in many ways. For this project we will use the following sequence, that starts at 1: yk = 2 yk-1 + 1 which means, the current number is the previous number times 2 plus one, and the sequence looks like this: { 1,3,7,15,31,63,127,255, etc. }. The Project Write a program that fills two arrays with the number sequence defined by the expression: yk = 2 yk-1 + 1. The sequence starts at 1. Here is what you have to do: Declare two 10 element DWORD arrays, say array1 and array2. Create a procedure called FillArray1. Calculate the first 10 numbers of the sequence and place them in array1. Create a procedure called FillArray2. Calculate the next 10 numbers of the sequence and place them in array2. Create a a procedure called PrintArrays. With this, write a message to the screen "The arrays are: " and print the arrays in two columns, side by side, with a header for each array: Array 1 and Array 2. The first array should be displayed in yellow and the second array in green. After the arrays are displayed, bring back the screen font color to the default color of light gray, so that the message "Press any key to continue ..." will be displayed in that color. To change the text color, call the SetTextColor procedure from the book's library. You can find SetTextColor procedure in your textbook, Chapter 5. In the main program call these 3 procedures. Therefore, the main program should be very simple: call FillArray1 call FillArray2 call PrintArrays
Explanation / Answer
#include int array1[10][10]; int array2[10][10]; int array3[10][10]; void fillArray1(void) { for(int i = 0; i < 10; i++) { for(int n = 0; n < 10; n++) { array1[i][n] = 2; } } } void fillArray2(void) { for(int i = 0; i < 10; i++) { for(int n = 0; n < 10; n++) { array2[i][n] = 5; } } } void arrayMultiplication(int array1[10][10], int array2[10][10], int array3[10][10]) { for(int i = 0; i < 10; i++) { for(int n = 0; n < 10; n++) { array3[i][n] = array1[i][n] * array2[i][n]; } } } int main() { fillArray1(); fillArray2(); arrayMultiplication(array1, array2, array3); std::coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.