Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<graphics.h>
  3. #include<math.h>
  4. int main()
  5. {
  6. int gd,gm;
  7. int r,i,a,b,x,y;
  8. float PI=3.14;
  9.  
  10. detectgraph(&gd,&gm);
  11. initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
  12.  
  13. //draw the top rectangle and color it
  14. setcolor(RED);
  15. rectangle(100,100,450,150);
  16. setfillstyle(SOLID_FILL,RED);
  17. floodfill(101,101,RED);
  18.  
  19. //draw the middle rectangle and color it
  20. setcolor(WHITE);
  21. rectangle(100,150,450,200);
  22. setfillstyle(SOLID_FILL,WHITE);
  23. floodfill(101,151,WHITE);
  24.  
  25. //draw the bottom rectangle and color it
  26. setcolor(GREEN);
  27. rectangle(100,200,450,250);
  28. setfillstyle(SOLID_FILL,GREEN);
  29. floodfill(101,201,GREEN);
  30.  
  31. //draw the circle
  32. a=275; //center
  33. b=175; //center
  34. r=25; //radius
  35. setcolor(BLUE);
  36. circle(a,b,r);
  37.  
  38. //spokes
  39. for(i=0;i<=360;i=i+15)
  40. {
  41. x=r*cos(i*PI/180);
  42. y=r*sin(i*PI/180);
  43. line(a,b,a+x,b-y);
  44. }
  45.  
  46. getch();
  47. closegraph();
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement