you are right i had to put both ofstream and string declaration outside the switch statement to work...i guess the solution with the brackets is better but at least now i know what was wrong

thanks guys