Advertisement
fursty

krugova diagrama

Mar 13th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include<graphics.h>
  3. #include<math.h>
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.  
  10. initwindow(800,800);
  11. int rx=250,ry=200 ,ox=300,oy=300,n=7;
  12. double VhodA[7]={30,59,65,14,3,300,150},
  13. start=0,krai=0,gama=0;
  14. double sum=0;
  15. double oxp ,oyp,beta;
  16. double xt,yt;
  17. for(int i=0;i<n;i++)
  18. {
  19. sum+=VhodA[i];
  20. }
  21. for(int k=0;k<41;k++){
  22. for(int i=0;i<n;i++){
  23. gama=VhodA[i] /sum*360;
  24. krai=start+gama;
  25. setcolor(i+1);
  26. setfillstyle(1,i+9);
  27. beta=(start+gama/2) /180*3.14;
  28. oxp = ox + 0.1 * rx * cos(beta);
  29. oyp = oy - 0.1 * ry * sin(beta);
  30. sector(oxp,oyp-k,start,krai,rx,ry);
  31. start=krai;
  32. if(k==40){
  33. xt=oxp+1.2*rx*cos(beta);
  34. yt=oyp-k-1.2*ry*sin(beta);
  35. outtextxy(xt,yt,"asap");
  36.  
  37. }
  38. }
  39. }
  40. getch();
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement