[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Geometric Routines Up: Dodgems: A longer exercise Previous: Dodgems: A longer exercise

Arithmetic Routines

Write the following routines. You can assume that you have a random() routine that returns an integer in the range 0 to 2^31-1.

//Convert radians to degrees
int rtod(float radians);

//Convert degrees to radians
float dtor(int degrees);

//Return a number in the range 1 to 'maximum' inclusive
int random_integer(int maximum);



Tim Love
2001-07-05