source code to plot graph in GLUT?

can someone tell me the source code when i want to draw some graph in GLUT(openGL) and VC++ by giving it some function f(x) along x-axis and y-axis? is there any short source code available?
i need it urgent . please help me.
i am looking forward to you people.

Hi !

Well, when you have your function that calculates the x/y values it is pretty simple.

To render points:
glBegin( GL_POINTS);
glVertex2d( x,y); // this is in a loop
glEnd();

To render a “curve”
glBegin( GL_LINE_STRIP);
glVertex2d( x,y); // this is in a loop
glEnd();

Mikael