CSC 101 Lecture Notes Week 10

CSC 101 Lecture Notes Week 10
Review of Topics from Weeks 8 and 9;
Review of the Final Exam


  1. Review of two important C++ constructs -- constants and typedefs
    1. See the solution to program 5, from last week.
    2. Constant definitions, on lines 32 through 43
      
      
      
      //
      // Constant definitions
      //
      const int DECK_SIZE = 52;        // Number of cards in a deck
      const int CARD_STR_LEN = 4;      // Number of chars in a card string
      const int MAX_HAND_SIZE = 20;    // Maximum number of cards in any hand
      const int SUIT_POSITION = 2;     // Position of the suit char in a card
      const int MAX_SHUFFLES = 10;     // Maximum number of times to test shuffle
      const char BLANK_CARD[] = "   "; // A blank card in a deck or hand
      const int MAX_INSTR_LINES = 500; // Max number of lines in instructions file
      const int MAX_INSTR_COLS = 80;   // Max number of columns in instructions file
      
      
      
    3. Typedefs on lines 44 through 76
      1. For example, typedef of Deck on lines 44 through 53:
        
        
        
        //
        // Type Deck is an array of char strings.  It represents the card deck used in
        // game play.
        //
        typedef char Deck[DECK_SIZE][CARD_STR_LEN];
                      //  ^^^^^^^^^  ^^^^^^^^^^^^
                      //  ^^^^^^^^^  ^^^^^^^^^^^^ CARD_STR_LEN is the size of each
                      //  ^^^^^^^^^                 array element (a card string)
                      //  ^^^^^^^^^
                      //  ^^^^^^^^^ DECK_SIZE is the size of the deck array
        
        
        
      2. The Deck type is used in subsequent parameter and variable declarations, such as the declaration of function Shuffle on lines 78 - 87:
        
        
        void Shuffle(
            Deck unshuffled_deck,       // Unshuffled input deck
            Deck shuffled_deck          // Shuffled output deck
        );
        
        
        
      3. The typedef construct does not provide any fundamentally new power, just a convenient means to give long type definitions a mnemonic name.

  2. Completion of symbolic debugging examples (see Lab Notes Weeks 9 and 10 from last week).

  3. A quick review of Conventions Volume 2 (see the handout from last week).

  4. More examples of function pre- and postconditions (see the solution to program 4, from week 8).

  5. Review of multi-file program structure (see again the solution to program 4).

  6. Note requirements for program 6
    1. You are required to structure your solution to programming assignment 6 into multiple files.
    2. Per the conventions, you are required to provide pre- and postconditions for all function declarations for programming assignment 6.

  7. Review of the final exam.
    1. Date and time
      1. Section 01: Wednesday 1:10PM - 3:00PM
      2. Section 03: Wednesday 7:10AM - 9AM
    2. Open book, open note.
    3. Content:
      1. Cumulative.
      2. Will focus on work done in the programming assignments.
      3. Will involve program analysis and synthesis questions, as on the midterm and quizzes.
      4. Will emphasize (but not be strictly limited to) the following concepts:
        1. Assignment
        2. Conditionals
        3. Loops
        4. Functions
        5. Arrays
        6. Program design


index | lectures | labs | handouts | assignments | solutions | grades | help