#include <graphics.h>
int main(void)
{
int gm = DETECT, gd, x, y;
int arr[] = { 540, 220, 530, 270, 570, 320, 510, 320, 490, 270, 540, 220 };
struct linesettingstype ls;
initgraph( &gm, &gd, "C:\\TC\\BGI" );
x = getmaxx();
y = getmaxy();
/* RECTANGLE */
rectangle(x / 30, y / 20, x / 5, y / 4);
outtextxy(x / 30 + 15, y / 8 + 5 ,"RECTANGLE");
/* CIRCLE */
circle(x / 2, y / 6, 75);
putpixel(x / 2, y / 6, WHITE);
outtextxy(x / 2 - textwidth("CIRCLE") / 2, y / 6 + 10, "CIRCLE");
/* ARC */
arc(x / 5, y / 2, 300, 90, 80);
outtextxy(x / 4, y / 2, "ARC");
/* LINES */
/* DEFAULT SETTINGS */
line(x / 30, y / 2, x / 6, y / 2);
/* SAVE CURRENT SETTINGS */
getlinesettings(&ls);
/* CHANGE SETTINGS */
setlinestyle(DASHED_LINE, 0, THICK_WIDTH);
line(x / 30, 10 * y / 17, x / 6, 10 * y / 17);
/* RESTORE ORIGINAL SETTINGS */
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);
line(x / 30, 10 * y / 15, x / 6, 10 * y / 15);
outtextxy(x / 30 + 10, 10 * y / 15 + 10, "LINES");
/* ELLIPSE */
ellipse(x / 2, 10 * y / 17, 0, 360, 100, 50);
putpixel(x / 2, 10 * y / 17, WHITE);
outtextxy(x / 2 - textwidth("ELLIPSE") / 2, 10 * y / 17 + 10, "ELLIPSE");
/* POLYGON */
drawpoly(6,arr);
outtextxy(515, 270, "POLYGON");
getch();
closegraph();
restorecrtmode();
return 0;
}
int main(void)
{
int gm = DETECT, gd, x, y;
int arr[] = { 540, 220, 530, 270, 570, 320, 510, 320, 490, 270, 540, 220 };
struct linesettingstype ls;
initgraph( &gm, &gd, "C:\\TC\\BGI" );
x = getmaxx();
y = getmaxy();
/* RECTANGLE */
rectangle(x / 30, y / 20, x / 5, y / 4);
outtextxy(x / 30 + 15, y / 8 + 5 ,"RECTANGLE");
/* CIRCLE */
circle(x / 2, y / 6, 75);
putpixel(x / 2, y / 6, WHITE);
outtextxy(x / 2 - textwidth("CIRCLE") / 2, y / 6 + 10, "CIRCLE");
/* ARC */
arc(x / 5, y / 2, 300, 90, 80);
outtextxy(x / 4, y / 2, "ARC");
/* LINES */
/* DEFAULT SETTINGS */
line(x / 30, y / 2, x / 6, y / 2);
/* SAVE CURRENT SETTINGS */
getlinesettings(&ls);
/* CHANGE SETTINGS */
setlinestyle(DASHED_LINE, 0, THICK_WIDTH);
line(x / 30, 10 * y / 17, x / 6, 10 * y / 17);
/* RESTORE ORIGINAL SETTINGS */
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);
line(x / 30, 10 * y / 15, x / 6, 10 * y / 15);
outtextxy(x / 30 + 10, 10 * y / 15 + 10, "LINES");
/* ELLIPSE */
ellipse(x / 2, 10 * y / 17, 0, 360, 100, 50);
putpixel(x / 2, 10 * y / 17, WHITE);
outtextxy(x / 2 - textwidth("ELLIPSE") / 2, 10 * y / 17 + 10, "ELLIPSE");
/* POLYGON */
drawpoly(6,arr);
outtextxy(515, 270, "POLYGON");
getch();
closegraph();
restorecrtmode();
return 0;
}
No comments:
Post a Comment
kiss on google ads if you are anonymous because your ip is trackable.thank you.
......from.admin