OpenGL Landscape problam

Hello,I need some help for my program.
The program is to load a 24Bit BMP file and use the G value of the RAW data for hight to create a landscape. However There seems to have a BUG inside my code, but i can’t find it. I’ll be really appreciate any kind of help. The BUG is that when my landscape is not flat there will be some triangles missing.)
Also (This requirement may be too much), may you tell me where it used a lot of my resources, and how to improve it.

Thanks for helping.

I’m using VC++ 2010 Express (This code may be can be compile in GCC)

Hereis the source code download:
Sorry that my code is complex

also forgive of my poor English