A good answer might be:

##include <math.h>
#define PI 3.14159265

double length, angle;
double vector[2];

 . . .
 
length = some value
angle = some number of degrees

vector[0] =  length * cos( angle*PI/180.0 )

vector[1] =  length * sin( angle*PI/180.0 )

(Unfortunately, different compilers use different symbols for PI, and define it in different header files.)


Practice with Radians

Recall the steps to take in converting a vector given as length and direction into (x,y):

  1. Draw a sketch.
  2. Calculate x by projecting the length onto the x-axis
    (usually length*cos( θ ) ) )
  3. Calculate y by projecting the length onto the y-axis
    (usually length*sin( θ ) ) )
  4. Check answers against the sketch.

The steps are the same (of course) if the angle is given in radians.

QUESTION 9:

A vector is 4.5 units long oriented at 0.70 radians. Express the vector as ( x, y )T.