You put the <GL/glut.h> at the top, and then there is a display() function that you put all the code in, or put links to other functions where code is written. Here is an example of a code that draws a few white dots.
And there are functions like this for a keyboard:
There are mouse functions, special keyboard functions, and regular keyboard functions. It is the easiest way to make a game with OpenGL I know of!
void SpecialKeyHandler(int key,int x,int y)