Printing of graphics

I have written this code to genrate a grapgh on the screen . I m not able to take the print of this. I hv tried the print screen but no use . Pls help me to solve this problem

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gd=DETECT, gm;
initgraph(&gd, &gm," ");
int userpat=1;
int x1,y1,y2,x2;
cout<<"Enter the coordinates of line";
cin>>x1>>y1>>x2>>y2;
setlinestyle(DOTTED_LINE,userpat,2);
line(x1,y1,x2,y2);
getch();
closegraph();
}

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<fstream.h>
void main()
{
ofstream outfile;
outfile.open(" dottedoutput.txt");
clrscr();
int gd=DETECT, gm;
initgraph(&gd, &gm," ");
int userpat=1;
putpixel(100,100,8);
int x1,y1,y2,x2;
cout<<"Enter the coordinates of line";
cin>>x1>>y1>>x2>>y2;
setlinestyle(DOTTED_LINE,userpat,2);
line(x1,y1,x2,y2);
getch();
closegraph();
//outfile<<initgraph(&gd, &gm," ")<< " \t"<< endl;
outfile.close();
}
What is your complier?
Printing the graph on the screen depend on the library!
Standard C++ does't have the graph library!
I m using tc++ and i want to know the method so that i can get the print of whatever i had genrated at run time
Thanks for reply
Turbo c++ ?
It is a outdate product!
You can try the gcc or Vc!
I had not used this complier to print the graph!
Thanks for sugestion i will try.
If i try on borland C ++ compiler then will it give me result.
I means will the method to print will be the print screen or somthing else code is written above.
You can try the MS's GDI or the open source software(openCV)!
openCV can print the graph in the console!
Topic archived. No new replies allowed.