Calculate the first 10 numbers of the sequence and place -


This program uses Assembly Language and should be done with Visual Studio 2013A 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 = 2yk-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 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

Very important: Do not hardcode numbers in your procedures. Do not increment the arrays with hard numbers. As we did in previous labs, use the SIZEOF, TYPE, and LENGTHOF operators to make the program as flexible as possible to support the array size and type being changed in the future.

Solution Preview :

Prepared by a verified Expert
Assembly Language: Calculate the first 10 numbers of the sequence and place -
Reference No:- TGS01128767

Now Priced at $75 (50% Discount)

Recommended (95%)

Rated (4.7/5)