Lecture Notes for Introduction to Computer Science II

22 May 2001 - Review and Extensions


  1. types, values, and operators

    1. review

      1. every value has a type

      2. a value's type determines which operations are legal

      3. some of the basic types are char, int, double

        1. also known as the primitive, atomic, built-in, or pre-defined types

      4. some types are related to other types - a char is an int is a double

    2. extensions

  2. arrays

    1. review

      1. an array is a collection of identically typed values

        1. the values are known as elements; the values' type is known as the element type or the array base type

        2. almost any type can be an array base type, even another array type

      2. an array's size is the number of values it can hold.

        1. an array's size is fixed, it can not easily be changed

      3. elements in an array are named by an integer called the array index

        1. legal index values run from 0 to n - 1

        2. the square bracket operator [] access array elements

      4. what kind of value is an array

    2. extensions

  3. functions and parameters

    1. review

      1. a function acts like its mathematical counterpart

        1. it accepts input values and returns an output value

      2. the input values are known as arguments or parameters

      3. the output value is known as the return value, the function value, or the function return value

      4. the function body is responsible for turning the arguments into the return value

    2. extensions

  4. i-o

    1. review

      1. i-o moves data into and out of a program

      2. c++ i-o is complex

      3. i-o streams are the simplest way of doing i-o

      4. the stream insertion operator << and stream extraction operator >> insert and remove values into and out of i-o streams

      5. i-o stream operators can fail

    2. extensions

  5. records

    1. review

      1. a record is a collection of differently typed values

        1. the values are known as fields; a value's type is known as the field type

        2. almost any type can be a field type, even another record type

      2. a record in c++ is called a struct or a class - we'll stick with struct for the moment

      3. each field in a struct is given a name called the field name or tag

        1. each field name in a struct must be unique

        2. the dot operator . access struct fields

      4. what kind of value is a struct

    2. extensions


This page last modified on 21 May 2001.