"Doesn't work" is not very useful. Is it sitting on the couch
all day, watching television? Can't it be compiled? Does it
do something, but not what you expect? Do you bring in your
car to the mechanics and say "Fix it, it doesn't work"?
Be more specific. As shown in another post in this thread,
the code you supply does work for me. At least, it fits my
definition of "working code". But we don't know what yours is.