Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider the textbook figure 8.5 and the slice example in the lower left corner, matrix(:4, 2:8:2). Write the corresponding Go program (hw3.go file) to

image text in transcribed

2. Consider the textbook figure 8.5 and the slice example in the lower left corner, matrix(:4, 2:8:2). Write the corresponding Go program (hw3.go file) to create and use that slice. First create a 10x10 array and populate it with numbers from 1 to 100 in a row order. Then create the slice for that array Print the slice. Modify the array by adding 100 to all the elements in the second column. Print the slice again. The output must be: C[11 12 13 14] [31 32 33 34] [51 52 53 54] [71 72 73 74]] C[11 112 13 14] 31 132 33 34] [51 152 53 54] [71 172 73 74]] Make sure to comment your code and to explain how it works. (20 points) matrix(3:6, 4:7) matrix(6:, 5) matrix(:, (/2, 5, 9/)) Figure 8.5 Array slices (sections) in Fortran 90. Much like the values in the header of an enumeration-controlled loop (Section 6.5.1), a : b: c in a subscript indicates positions a, a c, omitted, 1 is assumed. It is even possible to use negative values of c in order to select positions in reverse order. The slashes in the second subscript of the lower right example delimit an explicit list of positions. 2. Consider the textbook figure 8.5 and the slice example in the lower left corner, matrix(:4, 2:8:2). Write the corresponding Go program (hw3.go file) to create and use that slice. First create a 10x10 array and populate it with numbers from 1 to 100 in a row order. Then create the slice for that array Print the slice. Modify the array by adding 100 to all the elements in the second column. Print the slice again. The output must be: C[11 12 13 14] [31 32 33 34] [51 52 53 54] [71 72 73 74]] C[11 112 13 14] 31 132 33 34] [51 152 53 54] [71 172 73 74]] Make sure to comment your code and to explain how it works. (20 points) matrix(3:6, 4:7) matrix(6:, 5) matrix(:, (/2, 5, 9/)) Figure 8.5 Array slices (sections) in Fortran 90. Much like the values in the header of an enumeration-controlled loop (Section 6.5.1), a : b: c in a subscript indicates positions a, a c, omitted, 1 is assumed. It is even possible to use negative values of c in order to select positions in reverse order. The slashes in the second subscript of the lower right example delimit an explicit list of positions

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

=+Trainers from headquarters? Local trainers? Independent trainers?

Answered: 1 week ago