Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have tried to solve the whole thing but I couldn't, please help me understand it more and how can I solve this. - Create

I have tried to solve the whole thing but I couldn't, please help me understand it more and how can I solve this.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

- Create a 3D array - Iterate through a 3D array - Implement an abstract algorithm Instructions in this lab assignment, you will create a 3-dimensional array of numbers of size 101010(1000 elements), and populate each element of the 3D array with a randomly generated integer value in the range from 0999 (inclusive). The RNG seed will come from the input. Populate the array by generating random numbers and assigning in the following order begin at (x,y,z)=(0,0,0) and progress down the x axis with y=z=0. Put the next random number in that array location. After a line of 10 values in the x-direction is filled, advance to the next row in the y direction. After a (x,y) plane of values are filled, advance in the z-direction. This diagram shows in blue the first 13 blocks that would be populated. The 101 st block will be at location (x,y,z)=(0,0,1). Next, a specific (x,y,z) location will come from input. First error check that the (x,y,z) location actually occurs within the 30 array. If it does not, write an error statement and end the program. Otherwise, compute the sum of all the values extending from the (x,y,z) location perpendicular to the far edge of the cube in each of the 3-directions; as shown by the red blocks in this figure. The end of the program will output the sum of these values. When the program is complete: Sample Output [2 examples shown] User input 22676 Program Output Part B check: 321 Part A Declare a 3 dimensional array of datatype unsigned int named array. Use the const variable ARRAY_SIZE that is already declared in the template (i.e. do not "hard code" it with 10). Check your answer to this part When the input is 900123 Your output should be Part B Populate the 3D array using a 3-level nested for loop. You will need to declare some indexing integer variables for these loops. Pay close attention to the instructions and diagram for the order in which values are assigned. Remember the inner-most loop occurs first. Generate random numbers using the rand() function, and constrin the possible ranciom values to 0 -999 (inclusive) using the modulus operator. Check your answer to this part When the input is 672 274 Your output should be Part c Check whether the (x,y,z) location coming from stdin is valid. If it is not, print the error message (see example above) and end the program early using a return statement. Check your answer to this part When the input is 222115 Your output should be Part B check: 321 Error. Invalid array index. Part D Calculate the sum of the red blocks as described in the instructions and demonstrated in the diagram. You will want to use some loop to accomplish this, and may need to declare some new integer counter variables (or possibly reuse the ones from Part B). Be careful not to count the "corner" value more than once. Check your answer to this part When the input is 22676 Your output should be Part B check: 321 3909 Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. main.cpp Load default template... Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box 3940414243444546474849505152533else{cout"Error.Invalidarrayindex."endl;}IlcreatesumIlPartDIladdyourcodehereIlwritesumtostdoutcoutsumendl;return0; Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the programs output in the second box

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

Step: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago