0

Would u help me with this task, I am new in C++ programming, this codes have alot of errors, I have never work with graphs before, I am using Borlard C++ Ver 5.02. I was told u can not run a graph task using text editor. If that is the case how can I run this. I have only 7Days to handin this Task.
(a) Explain what process are being carried out by each method.
(b)Test this code on your system and report the outcome of your tests in a systematic manner. You need to provide a rationale for every test undertaken.
(c)Write a critical review of a given code and identify any strengths or weakness that may be present.

#include <graphics.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <conio.h>
const int X0=320;
const int Y0=240;
const float PI=3.14159;
const int NUME=30;
const DENOM=100;
const int NUMBER=7;
const float RAD=3.0;
const float DELTA=0.1;
const int SEGS=60;
const int REDUX=3;
const int MIN=1;
class cluster
{
Public:
void display(int size, int x, int y);
};
class tendril
|
Public:
void display (int size, float theta, int x, int y);
};
void cluster::display(int size, int x,int y)
{
if (kbhit())
exit(0);
for(int i=0;i<NUMBER;i++)
{
float theta i*2*PI/NUMBER;
moveto(x,y);
tendril t;
t.display(size,theta, x,y);
}
}
void tendril::display(int size, float theta, int x,int y)
{
for(int j=0;j<size;j++)
{
int chng=(random(DENOM)<NUME)?-1:1);
theta=thetha+chng*DELTHETA;
x=x+RAD*sin(theta);
y=y+RAD*cos(theta);
if(size<4)setcolor(RED);
else if(size<13)setcolor(GREEN);
else if(size<40)setcolor(LIGHTGREEN);
else setcolor(YELLOW);
lineto(x,y);
}
if(size>MIN)
{
cluster c;
int newsize=size/REDUX;
c.display(newsize,x,y);
}
}
void main ()
{
int driver, mode;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,"\\bc5\\bgi");
randomize();
int x=X0, y=Y0;
int size=SEGS;
cluster c;
c.display(size, x,y);
getch();
closegraph();
}
2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
0

>>this codes have alot of erro
Well, you need to fix them :-/ Look at the first error, fix it, then recompile. If more errors then repeat the above.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.