Lecture4 - Engineering Computation ENG 1D04 ENG 1D04...

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

View Full Document Right Arrow Icon
1 Engineering Computation ENG ENG 1D04 1D04 Lecture 4: Arrays…sorting… 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 Announcements • Quizzes : best 4 out of 5 • Marked lab: NO materials are allowed, NO internet connection, NO WebCT (except when submissions is ready) • Computer club: Wednesday 6:30pm, JHE320 • Midterm: February 24 th , 7:00pm – 9:00 pm – 30 questions
Background image of page 2
3 Need it? • Arrays are needed in almost all programs. • An effective way to store data. • An efficient way to sort/search data.
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 Declaration • int [] arrInts = new int[8]; type array name Instruction to compiler type Number of elements
Background image of page 4
5 Static vs. Dynamic allocation int[] arrInts = new int[6]; int val; val = Convert.ToInt32(txtInput.Text); int[] arrInts = new int[val];
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 Using arrays • int[] arrInts = new int[6]; 0 5 0 4 0 3 0 2 0 1 0 0
Background image of page 6
7 Using arrays • int[] arrInts = new int[6]; • arrInts[2] = 7; 0 5 0 4 0 3 7 2 0 1 0 0
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 Using arrays • int[] arrInts = new int[6]; • arrInts[2] = 7; • arrInts[3] = arrInts[2] + 1; 0 5 0 4 8 3 7 2 0 1 0 0
Background image of page 8
Using arrays
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

Lecture4 - Engineering Computation ENG 1D04 ENG 1D04...

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

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