The COORDINATES used in making rectangle, line circle etc,

Hello, everybody
Am new in programing as i started c++ few months ago , now that am learning the graphics mode (graphics. h) i am finding some difficulty in it. Like when we try to make a rectangle using <graphics.h>
1
2
3
4
5
6
7
8
9
10
11
12
 #include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:/tc/bgi");
rectangle (50,275,150,400);
getch();
closegraph();
}



Please note * Am using turbo c++ , yeah i know its too old but this code works.


I am confused with the coordinates used while making rectangle like
Rectangle(50,275,150,400)
What that 50 and 275 means , is that x -axis or y-axis and why are 4 parameters there . Plz explain me like i have no idea what numbers i will write to get that rectangle in center of the screen .

Thanks
I suggest you find and read the documentation for that function.

Where to find it?
I tried on google but i didnt got it , i dnt know what those coordinates are called, . any link or source?
I tried on google but i didnt got it

You surely didn't try very hard. I found documentation, about 88,000 different results with a very simple search. A decent set of documentation was available on the first page of these results.

What phrase did you use for your search?

You really should consider changing to a modern compiler and abandon that relic if you really want to learn to program.

PS. I looked at the manual for that compiler. Perhaps you should look for the manual in the library of your school?
Last edited on
I told u , ryt i dont even know what to search about , thats why i asked what those are called so that i can search about.

And about compiler, am forced to use this because of school ,
, any link that would help me?
Why don't you? You know you're using Turbo-C and you know you want information about the rectangle function. So why don't you combine a couple of the terms in the previous sentence and see what you come up with?

Something like:
http://lmgtfy.com/?q=Turbo-C+rectangle
If I recall correctly, the Turbo C Graphics uses an coordinate system that the top left corner is (0, 0), and the bottom right corner to be (getmaxx(), getmaxy()).

The rectangle() function requires 4 parameters, which are (left, top, right, bottom).
Topic archived. No new replies allowed.