The first part was correct, with one exception:
Code:
for (int i = 0; i <= num_x; i++)
Vectors are like arrays, they are indexed starting at 0, and going to index size-1.

Viggy