Since you haven't posted a complete, compilable program, it would be helpful if you told us what isn't working. Are you getting errors or warnings when compiling it? Do you see unexpected behaviour...