Lecture An introduction to computer science using java (2nd Edition): Chapter 9 - S.N. Kamin, D. Mickunas, E. Reingold

17 33 0
Lecture An introduction to computer science using java (2nd Edition): Chapter 9 - S.N. Kamin, D. Mickunas, E. Reingold

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 9 - Nested loops and two-dimensional arrays. In this chapter we will: show how nested loops are useful, introduce two-dimensional arrays, describe the use of two-dimensional arrays to represent grids of information, show how computer graphics are generated using pixels.

Chapter Nested Loops and Two-Dimensional Arrays Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N Kamin, D Mickunas, E Reingold     Chapter Preview In this chapter we will: • show how nested loops are useful • introduce two-dimensional arrays • describe the use of two-dimensional arrays to represent grids of information • show how computer graphics are generated using pixels     Nested for Loops • Nested loops frequently used to process twodimensional arrays • Often body of inner loop is where the main computation is done • Example: for (i = 0; i < m; I++) { before inner loop for (j = 0; j < n; j++) body of inner loop after inner loop };     Dependent for Loops • Sometimes the extent of the inner nested loop will depend on the index value of the outer loop • Example: for (i = 0; i < 3; i++) { out.print(“i= “; + i + “: j = “); for (j = 0; j

Ngày đăng: 15/05/2020, 22:29

Mục lục

  • Chapter 9 Nested Loops and Two-Dimensional Arrays

  • Nested Loop Contained in Other Statements

  • Bresenham’s Line Drawing Algorithm

  • Two-Dimensional Arrays and length

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan