My professor has given me the code and I wanna run it. I use Visual Studio2008. Code contains data structure "queue". He defines one queue as "queue<int> Q;"

But my compiler gives an error and says "error C2065: 'queue' : undeclared identifier"

Do we need any separate header file to run this? Or what's wrong?

-Thanks,
Sam

Yes, you need the header queue.

Does this code use the STL queue (looks like it) or a custom-written one?

Either way, it sounds like you are either missing a header, or you haven't resolved your namespace properly.