If you indent your code (use code tags) it may be easier to see what is going on but it looks like the { at the top of the code that is causing the problem. It simply shouldn't be there...
I agree it would help if you used the code tags, but i've had a look and spotted no namespace at the beginning.. If you just didn't post all your code then this may be redundant, but I can't tell from what you've posted.
there are more errors in the code, but this gets rid of the one you had.
thank you ahoysailor and chriscpp. I combined the program one of you gave me with the corrections of the other one, and it finally worked! so...thanks!