for loop in display function not working properly

The following function is called from the display function and the ReadCp function is updating the finalgrass vector.
Actually the for loop is not running till the limit i.e. m<5 but it runs for three increments only regardless of the increment. Don’t know why this is happening.

If you have even 1 percent idea please please help.

void OuterSurface()
{
ReadCp(1);
glColor3f(0.8,0.5,0.1);
glBegin(GL_LINE_STRIP);
for(double m=0;m<5;m=m+0.2)
{
double r=20;
for(double j=0;j<360; j=j+40)
{
for(int ii=0;ii<finalgrass.size();ii++)
{
MyPoint temp2=finalgrass[ii];
if(m==temp2.x && (j>(temp2.t-0.01) && j<(temp2.t+0.01)))
{
r=temp2.r;
}
}
glVertex3f(m,r*cos(j*PI/180),r*sin(j*PI/180));
}
}
glEnd();
}

i am using vc++ 2010 with glut. Please help.

Whats with the ReadCp()?

Why do you think the for loop is not working?