Explain why you might want to use a two-dimensional array.

What will be an ideal response?


Sometimes locating a value in an array depends on more than one variable. If you must represent values in a table or grid that contains rows and columns instead of a single list, then you might want to use a two-dimensional array. A two-dimensional array contains two dimensions: height and width. That is, the location of any element depends on two factors. For example, if an apartment's rent depends on two variables-both the floor of the building and the number of bedrooms-then you want to create a two-dimensional array.

Computer Science & Information Technology

You might also like to view...

Which of the following statements is false?

a. IntStream methods range and rangeClosed each produce an ordered sequence of int values. b. IntStream methods range and rangeClosed take two int arguments representing the range of values. c. Method range produces a sequence of values from its first argument up to its second argument. d. Method rangeClosed produces a sequence of values including both of its arguments.

Computer Science & Information Technology

By default, the color swatches displayed in the color palette window are the ____ Web-safe colors.

A. 16 B. 216 C. 256 D. 526

Computer Science & Information Technology

With Internet speeds what they are today, you do not have to consider file size any longer when designing web pages.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. A C++ declaration introduces only an identifier's spelling and specifies its type. 2. A C++ declaration is a definition that also allocates storage for an identifier's value (or function's body etc.). 3. The range of values for an int variable is from about 0 to +2 billion. 4. The names x, y, and z are satisfactory variable names for the lengths of the legs and hypotenuse of a triangle. 5. In C++ you can assign an expression of type int to a variable of type double with no problem.

Computer Science & Information Technology