| | |
How do i put colour into this program help please
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 0
#include <conio.h>
#include <graphics.h>
#include <math.h>
#include <stdlib.h>
#include <dos.h>
void serp(int level, int Ax, int Ay, int Bx, int By)
{
int poly[4]={Ax,Ay,Bx,By};
setfillstyle(SOLID_FILL,YELLOW); not working the way i want.
if (level>0)
{
serp(level-1, Ax,Ay ,(2*Ax+Bx)/3,(2*Ay+By)/3);
serp(level-1,(2*Ax+Bx)/3,(2*Ay+By)/3,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6);
serp(level-1,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6,(Ax+2*Bx)/3,(Ay+2*By)/3);
serp(level-1,(Ax+2*Bx)/3,(Ay+2*By)/3,Bx,By);
}
else fillpoly(2,poly);
}
int main(void)
{
int graphdriver=DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "");
int i, N=8, Bx=0, By=235, Ax=635, Ay=235;
for (i=0; i<N; i++)
{
serp(0,Ax,Ay,Bx,By);
serp(1,Ax,Ay,Bx,By);
serp(2,Ax,Ay,Bx,By);
serp(3,Ax,Ay,Bx,By);
serp(4,Ax,Ay,Bx,By);
serp(5,Ax,Ay,Bx,By);
serp(6,Ax,Ay,Bx,By);
serp(7,Ax,Ay,Bx,By);
delay(1000);
cleardevice();
}
getch();
closegraph();
return 0;
} Last edited by Ancient Dragon; Nov 15th, 2008 at 2:57 pm. Reason: add code tags
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- code illiterate - add text from 5 TEdit to 1 (Pascal and Delphi)
- Tkinter Help (Python)
- windovs media player (Windows NT / 2000 / XP)
- Setting the command buttons Forecolor (Visual Basic 4 / 5 / 6)
- Hello, im in dire need of help. (Viruses, Spyware and other Nasties)
- Helping for initialization (C++)
- Helping for initialization (C++)
Other Threads in the C++ Forum
- Previous Thread: problem with class static member.
- Next Thread: Visual c++ problem
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream input int integer java lib linux list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





