thank you for your help. if this includes c++ code then i'm sorry but i've been learning c and this program came from a c tutorial. though obviously not a very good one