CS 106B Lecture Notes - Lecture 2: Foreach Loop, Default Constructor

39 views2 pages

Document Summary

Announcements: assignment 1 is due on friday at noon, sections start this week, lair is now open. 6pm to midnight sun thurs: handout to go along with extra problem in lecture, cs for social good. Everyone gives feedback for two designated lectures. Collections: vector; grid; map; stack; queue; set. Today"s goals: learn how to use vectors, learn how to use grids, know how to do fauxtoshop. A list of elements that can grow and shrink. Each element has a place (or index) in the list. Arrays are fixed size and don"t even know their size: vector creation. Can also append/ remove something at a specific index, but must shift everything else, so more time-consuming: vector value output. For-each loop more elegant, but cannot call specific values. Advanced 2d array (think spreadsheets, game boards: important details. Default constructor makes a grid of size 0. To set specific values, use grid[row][column] = value;

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