# hw3 - The rows increase by values of 1 starting at 0 The...

This preview shows pages 1–2. Sign up to view the full content.

Problem 1- This program uses an array and starts at k=1 but the values are k-1 so it displays array 0-4 and then the value of these numbers using a log. K then goes from 1 to less than 6 so 5 arrays are displayed. It will display as follows. array[0]= 0.00 array[1]= 0.69 array[2]= 1.10 array[3]= 1.39 array[4]= 1.61 Problem 2- This program uses a void function along with 6 sets of numbers with a1 and a2. In the for loop n starts at 5 then decreases by 1 until it reaches 0. It then displays the a2 value as n then the void function is n+a1[n] so it is displayed as follows. a2[5]= 12 a2[4]= 10 a2[3]= 8 a2[2]= 6 a2[1]= 4 a2[0]= 2 Problem 3- This program uses a double array and creates a matrix. There are 4 rows and 2 columns which are defined in the for loops.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The rows increase by values of 1, starting at 0. The second row starts at 1 and increases by 1 as well. It is displayed as follows The ab matrix looks like this. 0 1 1 2 2 3 3 4 Problem 4- Six errors are as follows Error 1- In double h[ ], open parentheses are used instead of { }. Error 2- dim should be dim[3][2] instead of dim(3,2). Error 3- j isn’t declared next to integer. Error 4- in the if statement it says if(j=0), should be if (j==0) Error 5-2*h should be 2*h[i] Error 6- at the last cout line the values displayed are w[1] w[2] and w[3]; it should be w[0], w[1], w[2] because I starts at 0 and goes till 2 Output should be 4 10 16...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

hw3 - The rows increase by values of 1 starting at 0 The...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online