Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C++
#include iostream.h;
#include conio.h;
#include graphics.h;
class Hex
{
    private:
       int pts[12],dp[12];
       int x,y;
    public:
void Draw()
    {

for(int i=0;i<=7;i++)
{

/*Graphics bitmapGraphics = Graphics.FromImage(bitmap);*/

                pts[0] = new PointF(x, y);
                pts[1] = new PointF(x + 40, y);
                pts[2] = new PointF(x + 55, y + 15);
                pts[3] = new PointF(x + 60, y + 45);
                pts[4] = new PointF(x+100, y + 45);
                pts[5] = new PointF(x +115, y + 75);


dp[12]=new drawpoly(7,pts[0],pts[1],pts[2],pts[3],pts[4],pts[5],pts[0]);

/*bitmapGraphics.FillPolygon(     );*/
}

//bitmapGraphics.Dispose();
        bitmap.Dispose();
}
};

main()
{
hexa c;

   int gd=DETECT,gm;
   initgraph(&amp;gd, &amp;gm, &quot;C:\\TurboC3\\BGI&quot;);
cout&lt;&lt;&quot;enter the values of x and y&quot;;
cin&gt;&gt;x&gt;&gt;y;
c.Draw();

   getch();
   closegraph();
   return 0;

}
Posted
Updated 3-Dec-12 18:53pm
v2
Comments
Expert Coming 4-Dec-12 0:36am    
What is the problem you are having?
garima alreja 4-Dec-12 0:48am    
the turbo c complier gives following errors :
function containing for are not expanded inline
Albert Holguin 4-Dec-12 0:52am    
It's telling you to place the definition for the method Hex::Draw() in a cpp file, it doesn't like for() loops as inline functions.
garima alreja 4-Dec-12 0:56am    
i have to use a loop for repeatition
so what are you saying ? shall i dont use for loop and use hex::draw()
and this should be used where ?hex::draw() in main or inside class?
please explain clearly :(
Albert Holguin 4-Dec-12 0:58am    
You need to learn to use header files and code files. Your declarations go in headers, your definitions go in code files (cpp or c).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900