CPS 6, Ramm - Spring 2000 - 3/1/00 #18

Chap 7. Class Interfaces, Design, and Implementation

Chap 8. Arrays, Data, & Random Access

  • Vector Definition Syntax
    tvector<type> name;
    tvector<type> name(expression);
    tvector<type> name(expression, value);
    type is any with default (parameterless) constructor

  • Vector Initialization

    • Use Constructor
      • tvector<int> nums(4, -1);
      • tvector<string> words(12, "Hi");

    • Use Client Program
      for(k = 0; k < 4; k++)
          nums[k] = -1;
      
      for(k = 0; k < 12; k++)
          words[k] = "Hi";
      

  • Character Frequencies in Classical Cryptography
    • Crypoquotes in paper

  • Vector Parameters
    letters.cpp
    • char type
    • functions tolower(char), isalpha(char)
    • get(char) member function
    • fail() member function