First pick a graphics API, for 2d graphs I'd say SDL should do what you need and be easy to use.
Here you can find tutorials on how to set it up to work with various OS/compilers.
Then all you need to do is link it to your project.
Heres some code I made that sets up a screen buffer and draws an animated sine wave:
You should be able to get it to draw different kinds of graphs by playing around with it.
#define GRAPHICS_WIDTH 256
#define GRAPHICS_HEIGHT 256
#define BITDEPTH 32
#define DEG_TO_RAD 0.0174532925
SDL_Surface *screen = NULL; //This will be the screen buffer
void WritePixel(int x, int y, Uint32 col)
//First we set up the screen. If something goes wrong we quit the prog.
screen = SDL_SetVideoMode(GRAPHICS_WIDTH, GRAPHICS_HEIGHT, BITDEPTH, 0);
if(screen == NULL)
int quit = 0;
int anim = 0;
//This is the main loop that repeats until the program is ended
//Start each loop by clearing the screen
SDL_FillRect(screen, NULL, 0);
for(x=0; x<GRAPHICS_WIDTH; x++)
WritePixel(x, 128+cos(x*DEG_TO_RAD+anim)*100, 0xFFFFFFFF);
//Flip it into view
//This code checks for a keypress
if(++anim > 359) anim = 0; //Increment animation
Hope that helps.