Help for Rubik's Cube Rotation of each slice...

Any can please give opengl c++ code for Rubik’s cube…

i created rubik’s cube…

but i cant rotate each slice…

void colorcube()
{

for(i=0;i<=.66;i=i+.22)
{
	for(j=0;j<=.66;j=j+.22)
	{
		for(k=0;k<=.66;k=k+.22)
		{
			glColor3fv(colors[1]);
			glBegin(GL_POLYGON);
			glVertex3f(i-.3,j-.3,k-.3);
			
			glVertex3f(i-.3,j-.1,k-.3);
			glVertex3f(i-.1,j-.1,k-.3);
			glVertex3f(i-.1,j-.3,k-.3);
			glEnd();		
			glColor3fv(colors[2]);
			glBegin(GL_POLYGON);
			glVertex3f(i-.3,j-.3,k-.3);
			glVertex3f(i-.3,j-.1,k-.3);
			glVertex3f(i-.3,j-.1,k-.1);
			glVertex3f(i-.3,j-.3,k-.1);
			glEnd();		
			glColor3fv(colors[3]);
			glBegin(GL_POLYGON);
			glVertex3f(i-.3,j-.3,k-.3);
			glVertex3f(i-.3,j-.3,k-.1);
			glVertex3f(i-.1,j-.3,k-.1);
			glVertex3f(i-.1,j-.3,k-.3);
			glEnd();		
			glColor3fv(colors[4]);
			glBegin(GL_POLYGON);
			glVertex3f(i-.1,j-.1,k-.3);
			glVertex3f(i-.1,j-.3,k-.3);
			glVertex3f(i-.1,j-.3,k-.1);
			glVertex3f(i-.1,j-.1,k-.1);
			glEnd();		
			glBegin(GL_POLYGON);
			glColor3fv(colors[5]);
			glVertex3f(i-.1,j-.1,k-.1);
			glVertex3f(i-.3,j-.1,k-.1);
			glVertex3f(i-.3,j-.3,k-.1);
			glVertex3f(i-.1,j-.3,k-.1);
			glEnd();
			glBegin(GL_POLYGON);
			glColor3fv(colors[6]);
			glVertex3f(i-.1,j-.1,k-.1);
			glVertex3f(i-.3,j-.1,k-.1);
			glVertex3f(i-.3,j-.1,k-.3);
			glVertex3f(i-.1,j-.1,k-.3);
			glEnd();
		}
	}
}

}

I seriously doubt that anyone has a Rubiks cube lurking in their tool kits.
What is this for a school project?
Try to visualise a Rubiks cube and break it down to it’s basic components - namely 27 cubes arranged in a cuboid. Each row can be rotated around a central pivot, each column similarly. Now you can use gl rotations to manipulate sets of cube depending upon the pivot point you select.

This has come up before on these forums, so I will assume this is a school project. I highly doubt anyone here will do your project for you. However, if you put the effort forth, search the forums and google, and when you get stuck, show your code, ask for specific help, you will find folks here that are happy to help you move forward.

http://www.shaneliesegang.com/prattle/rubiks.php

http://www.youtube.com/watch?v=W3ptf-W3CWo

http://archive.msdn.microsoft.com/RubiksCubeSolver

http://users.ox.ac.uk/~orie1330/myprojects.html