Lecture6 - Engineering Computation ENG 1D04 ENG 1D04...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Engineering Computation ENG ENG 1D04 1D04 Lecture 6: Two-dimensional arrays & midterm samples Mihai Albu
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 © Copyright 2008 Mihai Albu & Alan Wassyng
Background image of page 2
3 Announcements • Quizzes • Labs • Office hours extended CRL 220 for midterm: – Monday 23 rd February, 9-18, – Break:1:30-2:30 (lecture) • Midterm – Use a PENCIL (bring your own). – Bring the student card.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 © Copyright 2008 Mihai Albu & Alan Wassyng
Background image of page 4
5 One-dimensional arrays • All the elements are connected via an index of the array – Easy to access and modify – Easy to use in a loop – Easy to sort, search, display • As a row…
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Two-dimensional arrays int [,] myArray = new int [rows,columns]; char [,] myChars = new char [rows, columns]; => Just like matrices
Background image of page 6
7 Declaration • int [,] yourMarks = new int [3,3]; • First index is the row • Second index is the column 0 0 0 2 0 0 2 0 0 1 0 0 0 1 0 yourMarks
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Usage • yourMarks[1,2] = 7; 0 0 0 2 0 0 2 0 0 1 0 0 0 1 0 yourMarks
Background image of page 8
9 Usage • yourMarks[1,2] = 7; 0 0 0 2 7 0 2 0 0 1 0 0 0 1 0 yourMarks
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Usage • yourMarks[1,1] = 1; 0 0 0 2 7 0 2 1 0 1 0 0 0 1 0 yourMarks
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2010 for the course CIVIL 2oi4 taught by Professor Lamiar during the Fall '10 term at McMaster University.

Page1 / 70

Lecture6 - Engineering Computation ENG 1D04 ENG 1D04...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online