Thankyou,
My programme works now, and I appreciate the advice concerning the systematic use of std::set.