Cube drawing

I’m trying to draw cube by following code. But somehow I’m not successful.

void CViewerView::drawCube()
{

        double d = 0.0f;			
	double steps = 4;			
	double twopi=2*3.14
        double s = twopi / steps;	
        double r = 50.0f;			
	double x0 = 0.0f;			
	double y0 = 0.0f;			
	double z0 = 0.0f;			
	double x1, z1;			
	int i  = 0;			
	double h = 20.0f;

for(i = 0; i <= steps; i++)			
	{
		d += s;				
		
		x0 = r * (double)cos(d);				
		z0 = r * (double)sin(d);				
		
		x1 = r * (double)cos(d + s);
		z1 = r * (double)sin(d + s);		
		
		
		//glBegin(GL_POINTS);			 				
		glBegin(GL_LINE_LOOP);			
		glVertex3f(0.0f, y0, 0.0f);				
		glVertex3f(0.0f+r, y0, 0.0f);				
		//glVertex3f(x0, y0, z0);		
		glVertex3f(x0,y0+r , z0);
		glEnd();
		
		x0+=r;
		//z0+=r;
		
		
		
		/*glBegin(GL_LINE_LOOP);
		//glVertex3f(0.0f, y0 +r, 0.0f);				
		glVertex3f(x0, y0 + r, z0);				
		glVertex3f(x1, y0 + r, z1);	
		//height
		//glVertex3d(x0,y0,z0+r);
		//glVertex3d(x0+r,y0,z0);
		glEnd();
		for(int j=0;j<i;j++)
		{
			glBegin(GL_LINE_LOOP);
		glVertex3f(0.0f, y0 +r, 0.0f);
		glVertex3f(x0, y0 + r, z0);
			glEnd();
		}*/


	}
	




  

take a look at nehe’s lesson #5. nehe’s tutorials