Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [20pts] Read today's lecture notes carefully and write key points (with a few sentences) below.
    What confuses me:
    
    
    
    
    Key points:
    
    
  2. [20pts] Assume the following delcarations and fill in the table with either the type of the given expression, or "error" if appropriate.
    
    struct Point {
      double x, y;
    };
    
    struct Trial {
      double stime, etime;
      Point *ways;
      int numways;
    };
    
    struct Subject {
      string name;
      int id;
      Trial pre, post;
    };
    
    Subject S;
    Subject* A;
    int i, j;
     
    expressiontype
    S.id
    A[i]
    A.pre.ways[i][j]
    S.post = A[i].pre;
    A[i].post.ways
    S.pre.ways[i]
    A[i].id = S.ways[i].y
    A[i].pre.ways[j].x
    A[i].post.ways.x
    S.pre.numways++
  3. [60pts] Write a program called raffle.cpp that simulates a raffle lottery. Your program will Of course, you should create a struct for each person that contains their name as well as an array of their ticket numbers. Example runs:
    ~/$ ./raffle
    How many people? 3
    Person 1 name: Dave
    Person 1 tickets: 650 205 592 377
    Person 2 name: Erin
    Person 2 tickets: 324 980 769 230
    Person 3 name: Jim
    Person 3 tickets: 442 230 296 230
    Winning ticket: 592
    Dave won!
    
    ~/$ ./raffle
    How many people? 2
    Person 1 name: Erin
    Person 1 tickets: 324 980 769 230
    Person 2 name: Jim
    Person 2 tickets: 442 230 296 230
    Winning ticket: 592
    
    ~/$ ./raffle
    How many people? 2
    Person 1 name: Erin
    Person 1 tickets: 324 980 769 230
    Person 2 name: Jim
    Person 2 tickets: 442 230 296 230
    Winning ticket: 230
    Erin won!
    Jim won!
    
    Turn In a screen capture of your program running on the above input, and a printout of your source code.