Homework 2

Physics 231C: Simulations in C++

Spring 1999

Problem Set 3

Due 12:30 pm Tuesday, April 27.

All problems from Textbook by Barton and Nackman. You can download the examples (like Point.h and Point.cc) in the book from the course home page.
  1. 2.13 Compare the results of the 2 versions of Stirling formula (with and without recursion).
  2. 4.1 Include the line "Point q[5];" in main (without the quotes) when you test the program.
  3. 4.2 (Note: The "moveTo" function changes the coordinates of the point.)
  4. 4.3
  5. 4.4 Allow for the fact that some external functions like main may still need the x and y coordinates, while other external functions may want the polar coordinates. However, to save space, only store polar coordinates; don't store both polar and cartesian coordinates.
In all the problems, implement your answers and test them with a simple program. Show a transcript of what happens when you compile and run the program in each case.