CSC 120 Lecture Notes - Lecture 21: Jagged Array

64 views11 pages
Verified Note

Document Summary

If a is a two-dimensional array, then a. length provides the size of the first dimension (i. e. , the number of rows) 0: output example, the code, read method that returns an int array: Instantiate a scanner object, prompt the user to enter the dimension of the input array, receive the dimension, and store the value in the variable len: ][ j ] = twod[ i ][ j - 1 ] + oned[ j ]; : return the array, print method; the formal parameter is a two-dimensional array: Use a double-for-loop to print the contents with the external loop for the rows: the internal loop prints each element using five character spaces: In the main method, call the read method to get data: next obtain the partial sums, finally print the contents of the partial-sum array, last line does everything in one line: print( partialsall( readdata() ) );

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents