R. Clayton (rclayton@monmouth.edu)
(no date)
I've made several updates to assignment 3:
* The input can consist of floating-point numbers, not just integers.
* I've made available a toy to generate input for your program.
* My solution to the problem's available.
* Be careful comparing floating-point numbers.
See the updated assignment page for details.
There's one other thing you should be aware of, a problem with g++. You're all
no doubt eager to put your new-found knowledge to work by inputting the data
like this:
std::copy(std::istream_iterator<point>(std::cin),
std::istream_iterator<point>(),
std::inserter(pts, pts.end()));
However, you have to be careful how you define the point data structure. Your
first guess is probably
typedef std::pair<double, double> point;
And that's not a bad guess, but unfortunately g++ can't compile istream
iterators when you're trying to use them to extract std::pairs(!). CC handles
this correctly, but I don't use CC to compile your assignments.
To have your copy work correctly, you have to skip std::pair and define your
own point:
struct point { double x, y; };
This archive was generated by hypermail 2.0b3 on Mon May 03 2004 - 17:00:06 EDT