By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Please Help Me With Graph Task in C++

P: 6
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.

The Message Error I am getting when running this programme is : GRAPHICS.H(20.52); Error directive:BGI graphics not supported under windows.
Expand|Select|Wrap|Line Numbers
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <math.h>
  5. #include <conio.h>
  6. const int X0=320;
  7. const int Y0=240;
  8. const float PI=3.14159;
  9. const int NUME=30;
  10. const DENOM=100;
  11. const int NUMBER=7;
  12. const float RAD=3.0;
  13. const float DELTA=0.1;
  14. const int SEGS=60;
  15. const int REDUX=3;
  16. const int MIN=1;
  17. class cluster
  18. {
  19. Public:
  20. void display(int size, int x, int y);
  21. };
  22. class tendril
  23. |
  24. Public:
  25. void display (int size, float theta, int x, int y);
  26. };
  27. void cluster::display(int size, int x,int y)
  28. {
  29. if (kbhit())
  30. exit(0);
  31. for(int i=0;i<NUMBER;i++)
  32. {
  33. float theta i*2*PI/NUMBER;
  34. moveto(x,y);
  35. tendril t;
  36. t.display(size,theta, x,y);
  37. }
  38. }
  39. void tendril::display(int size, float theta, int x,int y)
  40. {
  41. for(int j=0;j<size;j++)
  42. {
  43. int chng=(random(DENOM)<NUME)?-1:1);
  44. theta=thetha+chng*DELTHETA;
  45. x=x+RAD*sin(theta);
  46. y=y+RAD*cos(theta);
  47. if(size<4)setcolor(RED);
  48. else if(size<13)setcolor(GREEN);
  49. else if(size<40)setcolor(LIGHTGREEN);
  50. else setcolor(YELLOW);
  51. lineto(x,y);
  52. }
  53. if(size>MIN)
  54. {
  55. cluster c;
  56. int newsize=size/REDUX;
  57. c.display(newsize,x,y);
  58. }
  59. }
  60. void main ()
  61. {
  62. int driver, mode;
  63. driver=VGA;
  64. mode=VGAHI;
  65. initgraph(&driver,&mode,"\\bc5\\bgi");
  66. randomize();
  67. int x=X0, y=Y0;
  68. int size=SEGS;
  69. cluster c;
  70. c.display(size, x,y);
  71. getch();
  72. closegraph();
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.
Apr 26 '07 #1
Share this Question
Share on Google+
2 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
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.

The Message Error I am getting when running this programme is : GRAPHICS.H(20.52); Error directive:BGI graphics not supported under windows.
Expand|Select|Wrap|Line Numbers
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <math.h>
  5. #include <conio.h>
  6. const int X0=320;
  7. const int Y0=240;
  8. const float PI=3.14159;
  9. const int NUME=30;
  10. const DENOM=100;
  11. const int NUMBER=7;
  12. const float RAD=3.0;
  13. const float DELTA=0.1;
  14. const int SEGS=60;
  15. const int REDUX=3;
  16. const int MIN=1;
  17. class cluster
  18. {
  19. Public:
  20. void display(int size, int x, int y);
  21. };
  22. class tendril
  23. |
  24. Public:
  25. void display (int size, float theta, int x, int y);
  26. };
  27. void cluster::display(int size, int x,int y)
  28. {
  29. if (kbhit())
  30. exit(0);
  31. for(int i=0;i<NUMBER;i++)
  32. {
  33. float theta i*2*PI/NUMBER;
  34. moveto(x,y);
  35. tendril t;
  36. t.display(size,theta, x,y);
  37. }
  38. }
  39. void tendril::display(int size, float theta, int x,int y)
  40. {
  41. for(int j=0;j<size;j++)
  42. {
  43. int chng=(random(DENOM)<NUME)?-1:1);
  44. theta=thetha+chng*DELTHETA;
  45. x=x+RAD*sin(theta);
  46. y=y+RAD*cos(theta);
  47. if(size<4)setcolor(RED);
  48. else if(size<13)setcolor(GREEN);
  49. else if(size<40)setcolor(LIGHTGREEN);
  50. else setcolor(YELLOW);
  51. lineto(x,y);
  52. }
  53. if(size>MIN)
  54. {
  55. cluster c;
  56. int newsize=size/REDUX;
  57. c.display(newsize,x,y);
  58. }
  59. }
  60. void main ()
  61. {
  62. int driver, mode;
  63. driver=VGA;
  64. mode=VGAHI;
  65. initgraph(&driver,&mode,"\\bc5\\bgi");
  66. randomize();
  67. int x=X0, y=Y0;
  68. int size=SEGS;
  69. cluster c;
  70. c.display(size, x,y);
  71. getch();
  72. closegraph();
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.
Well, let's start with A. What do you think is being done by these functions?
Apr 27 '07 #2

P: 6
Well, let's start with A. What do you think is being done by these functions?
Thank u sicarie, I have cleared the errors, The programme is running Now, so I will score 40 marks.

Regards
Zak
Apr 28 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.