1. Trang chủ
  2. » Công Nghệ Thông Tin

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

17 66 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 17
Dung lượng 281,47 KB

Nội dung

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: 11/01/2020, 20:21

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN