Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

1. [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 Node
{
Point data;
Node* next;
};

Node *L;
double a, *ptr;
Point p;
```
 expression type `*L` `L = &p` `&(L->data)` `L.next` `p->x` `*ptr = L->data.x` `*(L->next)` `&a` `L->next->data.y` `new Node`
2. [15pts] Given the struct definition
```struct Node
{
int data;
Node* next;
};```
and variables `L` and `t`, both of type `Node*`, with the values depicted in the figure to the right, write statement(s) that perform the following. Note: each problem is independent, meaning that changes in one part are not carried forward into the next part.
1. Change the 8 to a 13:
2. Change the 2 to a 6:
3. Add the node `t` points to to the front of the list `L` — i.e. after these statements, `L` should point to the list 5,8,2,7.
3. [65pts] Take this program and break it up into a .h file and its associated .cpp file along with the .cpp file for main. The running program should work like this:
```~/\$ ./prog
Enter a list of positive numbers, terminated by zero:
7 2 9 33 14 10 9 18 7 0
The last number was 7
The next to last number was 18```

Turn In a printout of all three source code files (codeprint allows you to list several files to print all together, like `codeprint foo.h foo.cpp bar.cpp`), and a screenshot of a terminal window showing the program being compiled and running on the above example.