Advertisement
edutedu

suma cerc grafic

Nov 5th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <graphics.h>
  3. #include <conio.h>
  4. #include <dos.h>
  5. #include <time.h>
  6. #include <stdlib.h>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. { int x[10],s=0, n,k,j;
  12. int culoare=1;
  13. cout<<"cate numere se citesc ? ";
  14. cout<<endl;
  15. cin>>n; //citeste cate numere sunt
  16.  
  17. for(int i=1;i<=n;i++) //
  18. {
  19. cout<<"x=";//citeste termenii sumei
  20. cin>>x[i];
  21. s=s+x[i];//suma
  22. }
  23. initwindow(1000,1000);//creeearea paginii
  24. setcolor(10);
  25. rectangle(40,10,100+s*60,80);//crearea careului
  26. setfillstyle(SOLID_FILL,10);//umplere
  27. floodfill(99+s*60,11,10);
  28.  
  29.  
  30. for( j=1;j<=s;j++)
  31.  
  32. {
  33.  
  34. setcolor(culoare);
  35. circle (50+j*60 ,50 ,20);//desenare cercuri in fct de j
  36. setfillstyle(SOLID_FILL,culoare);//umplere
  37. floodfill(50+j*60 ,50 ,culoare);
  38. culoare ++;
  39.  
  40. }
  41.  
  42.  
  43.  
  44. getch();
  45. closegraph();
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement