473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please Help Me With Graph Task in C++

6 New Member
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.5 2); 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
2 2124
sicarie
4,677 Recognized Expert Moderator Specialist
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.5 2); 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
zakaria2710
6 New Member
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

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

Similar topics

9
2889
by: Lilith | last post by:
Is there a python module somewhere (been searching today, no luck) which has efficiently coded various graph-handling routines, such as finding the shortest path through a graph, or the set of all paths through a graph? I'm not a compsci-educated person, so coding my own would be less parsimonious. Thanks for any suggestions! D
1
4526
by: SallyBenjamin | last post by:
Hello.. Can anyone help me with this coding. Basically, it needs to have add node, remove node, add edges , remove edges and display the graph But.I have only succedded to add node, add and remove edge and also display graph... Can anyone plz help me to change this and add the nodes.. Thank u
2
2769
by: Christian Christmann | last post by:
Hi, I need to write a graph which provides at least the following functions: 1) stores nodes and edges (both store further information which can be of any type) 2) manipulations on nodes and edges like delete, add ... 3) provides a list of all successors/predecessors for a given node 4) provides a list of all nodes that can be reached...
0
1103
by: Joe | last post by:
Dear Friends, I want dynamically create the Graph from C# application. The graph would be timeInterval VS percentage. timeInterval percentage Recordno 8/2/2003 10:11:00 AM 10 ABC123 8/3/2003 10:11:00 AM 20 ABC123 8/4/2003 11:11:00 AM ...
1
9606
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the...
7
9024
by: vbnetdev | last post by:
My boss wants this done in a day. I would be happy with a week! Anyway, I have a dataset filled with data and need to populate an MS word chart with it when writing a report. Any tutorials or suggestions would be great. Sample data at http://www.kjmsolutions.com/sample.txt
0
1033
by: jatininfo02 | last post by:
Hi Friend i am working on a task where i have to display XML Stream data on a graph for a window application, data is coming in the form of xmstream continuously and we have to plot a graph of that data continually. Any one can suggest a any similar types of code.. Thanks Jitendra Pratap singh indurotech.jp@gmail.com
2
4126
by: sriniwas | last post by:
Hi Frnd's, m using prefuse visulation,it's have one display class and this class have one saveImage(outPutStream, String jpg,double size);. now graph is converting ia jpg image properly.now my problem is tht,If graph is to large if it going out of screen thn ,i m getting jpg image on screen disply graph,m not getting the image of tht graph...
8
1431
thatos
by: thatos | last post by:
I am trying to write an program which performs a breath first search on a graph and returns a tree. class Alist{ int x; Alist next; public Alist (){ } public Alist(int x){ this.x = x; next = null;
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.