Click here to Skip to main content
11,433,997 members (49,786 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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 3-Dec-12 19:35pm
Edited 3-Dec-12 19:53pm
(no name)254.4K
v2
Comments
Expert Coming at 4-Dec-12 0:36am
   
What is the problem you are having?
garima alreja at 4-Dec-12 0:48am
   
the turbo c complier gives following errors :
function containing for are not expanded inline
Albert Holguin at 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 at 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 at 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).
garima alreja at 4-Dec-12 0:52am
   
also it does not convert pts[0] = new PointF(x, y);
gives error :-cannot convert int* to int
Albert Holguin at 4-Dec-12 0:56am
   
Each element in your pts[] array is an integer (that's what you've defined), yet the return of calling new PointF() is going to be a pointer and not an integer. That's what the error is telling you.
garima alreja at 4-Dec-12 1:00am
   
so i need to use pts[0]=int pointf(x,y)
and can you please do ammendments in code and send it to me coz i need answers fast. its really very urgent .. please.
Albert Holguin at 4-Dec-12 1:01am
   
Nope... I'm not here to do your work. I'm just helping, you should be grateful I even helped that much instead of blatantly asking me to do your work. It's 1AM where I live and I'm at work.... that's how you achieve what you want, hard work.
Ashfaq A Memon at 8-Dec-12 2:28am
   
This is just warning not error
Because function containing any type of loops are not considered to be inline
garima alreja at 4-Dec-12 1:04am
   
i have my ip submittion in 2 hours n ive been trying for days to correct these errors....im not very good at c++ so please help me sir
Keith Barrow at 4-Dec-12 4:50am
   
I doubt, given that Albert actually gave you the root of the problem, and your subsequent attitude, that many people are going to be willing to help you. This is your homework, not ours.
garima alreja at 4-Dec-12 10:14am
   
mam , i am not defending what sir said .. but i was in tension that time in a very complicated situation .. so i said that .. i agreed i was rude . i regret for that .. am sorry.. i was not able to recover errors also didnt understood whatever sir said .. so please will you explain me properly the errors .. i 'll be very thankfull to you..
garima alreja at 4-Dec-12 10:20am
   
mam , iam not defending what sir said.. actually i was in tension that time . in a very complicated sitution due to overload .. i agreed i was rude .. and i regrett for that .. am sorry.. i didnt understood what sir said .. and was not able to recover errors .. so please kindly will you sort me.. explain me in details coz i have learnt basics of c++. i 'll be very thankfull to you .. i promise i 'll do myself the code. but just help me to recover errors..
garima alreja at 4-Dec-12 1:12am
   
please excuse my friend for what she said im uploading another code plzz check if that is correct...thanku
garima alreja at 4-Dec-12 10:21am
   
mam , iam not defending what sir said.. actually i was in tension that time . in a very complicated sitution due to overload .. i agreed i was rude .. and i regrett for that .. am sorry.. i didnt understood what sir said .. and was not able to recover errors .. so please kindly will you sort me.. explain me in details coz i have learnt basics of c++. i 'll be very thankfull to you .. i promise i 'll do myself the code. but just help me to recover errors..
garima alreja at 4-Dec-12 1:13am
   
{
cout<<"THE GSM CELLS ARE AS FOLLOW";

}

};
class red:public hexa
{
int a1=(x1=x=30,y1=y=15),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);
int a6=(x1=x=140,y1=y=15),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);
int ptr1[14]={a1,b1,c1,e1,f1,a1};
int ptr6[14]={a6,b6,c6,e6,f6,a6};


public:
void draw1_poly()
{
cout<<drawpoly(7,ptr1);
cout<<drawpoly(7,ptr6);
}
void colour1_poly()
{
cout<<setfillsytle(SOLID_FILL,RED);
}
};
class blue:public hexa
{
int a2=(x1=x=85,y1=y=105),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);

int ptr2[14]={a2,b2,c2,e2,f2,a2};

void draw2_poly()
{
cout<<drawpoly(7,ptr2);

}
void colour2_poly()
{
cout<<setfillsytle(SOLID_FILL,BLUE);
}
};
class green:public hexa
{
int a3=(x1=x=30,y1=y=135),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);
int a7=(x1=x=140,y1=y=75),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);


int ptr3[14]={a3,b3,c3,e3,f3,a3};
int ptr7[14]={a7,b7,c7,e7,f7,a7};

void draw3_poly()
{
cout<<drawpoly(7,ptr3);
cout<<drawpoly(7,ptr7);
}
void colour3_poly()
{
cout<<setfillsytle(SOLID_FILL,GREEN);
}
};
class yellow:public hexa
{
int a4=(x1=x=85,y1=y=105),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);
int a5=(x1=x=85,y1=y=-15),b1=(x2,y2),c1=(x3,y3),d1=(x4,y4),e1=(x5,y5),f1=(x6,y6);

int ptr4[14]={a4,b4,c4,e4,f4,a4};
int ptr5[14]={a5,b5,c5,e5,f5,a5};


void draw4_poly()
{

cout<<drawpoly(7,ptr4);
cout<<drawpoly(7,ptr5);
}

void colour4_poly()
{
cout<<setfillsytle(SOLID_FILL,YELLOW);
}
};
main()
{
char colour,red,blue,green,yellow;

hexa c;
red c1;
blue c2;
green c3;
yellow c4;
int gd=DETECT,gm;
initgraph(&gd, &gm, "C:\\TurboC3\\BGI");

c.disp();
c.set();
c1.draw1_poly();
c2.draw2_poly();
c3.draw3_poly();
c4.draw4_poly();

cout<<"***********************************";
cout<<"enter the colour";
cout<<"***********************************";
cout<<1. red<<endl<<2. blue<<endl<<3. green<<endl<<4. yellow;

if (colour==red)
{
c1.colour1_poly();
}
else if(colour==blue)
{
c2.colour2_poly();
}
else if(colour==green)
{
c3.colour3_poly();
{
else (colour==yellow)
{
c4.colour4_poly();
}

getch();
closegraph();
return 0;


}
garima alreja at 4-Dec-12 10:20am
   
mam , iam not defending what sir said.. actually i was in tension that time . in a very complicated sitution due to overload .. i agreed i was rude .. and i regrett for that .. am sorry.. i didnt understood what sir said .. and was not able to recover errors .. so please kindly will you sort me.. explain me in details coz i have learnt basics of c++. i 'll be very thankfull to you .. i promise i 'll do myself the code. but just help me to recover errors..

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



Advertise | Privacy | Mobile
Web03 | 2.8.150428.2 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100