Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10pts] Assume the following declarations. Next to each expression, write either the type of the given expression, or "error" if appropriate.

    struct GameRec {
      string first, last;
      int score;
    };
    
    struct Point {
      double x, y;
    };
    
    int i,j;
    double w;
    Point P;
    GameRec G;
    GameRec *A;
    Point* B;

    expression

    G
    B
    A.first
    A[i]
    A.first[i]
    A[i].first
    w + A[j].score
    B[i]
    P.x++
    G.score = w

  2. [90pts] Write a program that reads in a file like scoredata.txt, which contains player names and game-scores for players playing an online game, and prints out the names in decreasing order of score achieved.