-3

I have just started graphics in C++ and was making a simple program to create a rectangle but no output screen is coming even though i have used getch(). can someone please tell me what i am doing wrong.

#include<graphics.h>
#include<conio.h>
void main()
{
    int gm=0,gr=0;
    initgraph(&gm,&gr,"");
    cleardevice();
    rectangle(100,100,300,300);
    getch();
    closegraph();
} 
drescherjm
  • 10,365
  • 5
  • 44
  • 64

1 Answers1

1

Not sure but it seems that you are trying to create a window with size 0.

There are diferent libraries based on the same, if it is correctly installed you can try:

int gm = 800, gr = 600;
initgraph(gm,gr,"name");

or

int gm = 800, gr = 600;
initwindow(gm,gr,"name");

or you can look at the graphics.h file and search the function there and its parameters.

Ulises
  • 539
  • 3
  • 9