Can any one please help me out with the code that can do zooming in and out on an object?

gluPerspective(zoom, width/height, 0.1f, 1000.0f);

lower the value of zoom (a float) to zoom in, increase the value to zoom out.
Look up the specs on gluPerspective for more info on why that zooms.

Just a note, that “ZOOM” value is actually your “field of view”, which you may recognize from some games like Quake. A normal FOV value varies but some good numbers between 45 to 60 make a nice normal view. If you want to be able to zoom in when a player presses a key for example, you could gradually lower than value down to 10 when a key is pressed and it will appear to zoom in (smaller field of view), and then of course, just raise that value back up to your normal FOV when the key is released if that is what you like.