Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10pts] Assume the following delcarations and function definitions fill in the table. Note: "error" is a possiblity in the 2nd column. Note: each question is independent, i.e. no side effects of one expression shoudl eb taken to carry over to the next
    double x = 2.25;
    int n = 2;
    string s = "hard";
    int *A = new int[3]
    A[0] = 6; A[1] = 9; A[2] = 8;
    string *B = new string[2];
    B[0] = "hi"; B[1] = "bye";
    double *X = new double[3];
    X[0] = 5.1; X[1] = 5.4; X[2] = 5.7;
    expressiontypevalue (or error!)
    A[1] - x
    A[0] = X[n]
  2. [90Pts] Write a program that reads a number n from the user, reads an n-word sentence from the user, and then prints out the sentence in reverse (but not the words). A typical run of the program might look like this:
    ~/$ ./prog
    Number of words: 3
    Sentence: Sam I am
    am I Sam
    Use arrays not recursion! Turn In this cover sheet (obviously) and a printout of your program along with a screen capture showing it running on some clever sentence.