Hello,
I want to draw a polygon for my programme like this :
http://imageshack.us/photo/my-images/855/polygon.png
i followed some steps to draw polygon myself
1)search on internet about it but didnt understood
2)searched in c++ help it gave me "drawpoly" function to use but i didnt understood the working of that code or example.
i wrote the given example in c++.
the code is as follow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#define closegraph();
#define drawpoly();
#define getmaxy();
#define getmaxx();
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int maxx, maxy;
int poly[10];
initgraph(&gdriver, &gmode, "");
maxx = getmaxx();
maxy = getmaxy();
poly[0] = 20;
poly[1] = maxy/2;
poly[2] = maxx-20;
poly[3] = 20;
poly[4] = maxx-50;
poly[5] = maxy-20;
poly[6] = maxx/2;
poly[7] = maxy/2;
poly[8]=poly[0];
poly[9]=poly[1];
drawpoly( 7, poly);
getch();
closegraph();
return 0;
}
|
first it gave me error :
linker error : undefined symbol _closegraph in module file.cpp
it gave me for getmaxy, getmaxx(), drawpoly().
then i defined them and now its giving me error something like this :
maxx = getmaxx(); // expression syntax
maxy = getmaxy(); // expression syntax
drawpoly( 7, poly); // wrong number of arguments in call 'drawpoly'
so please help me in this working of programe.
and if u do write code please give info as comment in that code.
Thanking you.
smile :D