CIS22A - Notes for Week 10, 11/25-11/28

Announcements and Reminders


Topics

Terminology

Continuation of Arrays - Chapter 7

Range-based for loop   Textbook - Page 401.  Available in C++11

#include <iostream>
using namespace std;

int main()
{
    int a[10] = {1,2,3,4,5,6,7,8,9,10};
    
    for (int i = 0; i < 10; i++)

        cout << a[i] << "  ";
    cout << endl;

    for(int value : a)  // Range-based for loop
        cout << value << "  ";
    cout << endl;
}

Array practice

Find the maximum value in an array

Continuing the Cards and Decks Using Arrays


What is a "cstring"?

aka null-terminated char array

How is a cstring different from an int array?  How is it similar?

Example

Parse date text in the format "mon-dd-yyyy". Turn it into an int, like yyyymmdd 
"Mar-10-2015" becomes 20150310

Using parallel arrays

On what date did the maximum gain in Apple stock occur?


What is a vector?

range-based for loop

c-string
null-terminated char array

parallel arrays