Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4. #include <graphics.h>
  5. #include <math.h>
  6. #include <windows.h>
  7.  
  8.  
  9.  
  10. int snow(int i,int j,int c) {
  11. setcolor(c);
  12. setlinestyle(0,0,2);
  13. line(i,j,i+18,j+18);
  14. line(i,j+18,i+18,j);
  15. line(i+9,j+24,i+9,j-4);
  16. line(i-4,j+9,i+24,j+9);
  17. }
  18.  
  19. int main()
  20. {
  21. int i,j,x,y,s=0,a,b,c=1,w[600][600];
  22. initwindow(600,600);
  23. for (i=0;i<600;i++) {
  24. for (j=0;j<600;j++) {
  25. w[i][j]=0;
  26. }
  27. }
  28. for(i=0;i<1;)
  29. {
  30. c=1+rand()%14;
  31. x=10+rand()%580;
  32. y=10+rand()%580;
  33. snow(x,y,c);
  34. w[x][y]=1;
  35.  
  36.  
  37. for(s=0;s<5000;s++){
  38. a=10+rand()%580;
  39. b=10+rand()%580;
  40. if (w[a][b]==1)
  41. {
  42. c=0;
  43. snow(a,b,0);
  44. }
  45. }
  46. if (kbhit())
  47. break;
  48. }
  49. getch();
  50. closegraph();
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement