Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <time.h>
  3. #include <windows.h>
  4. #include <fstream>
  5. #include <iostream>
  6. #define longlongmax 18446744073709551615
  7. using namespace std;
  8. int main()
  9. {
  10. ofstream gowno;
  11. gowno.open("gowno_madry.txt");
  12. unsigned long long int c[7];
  13. c[0]=0;
  14. c[1]=0;
  15. c[2]=0;
  16. c[3]=0;
  17. c[4]=0;
  18. c[5]=0;
  19. c[6]=0;
  20. bool a[6];
  21. a[0]=0;
  22. a[1]=0;
  23. a[2]=0;
  24. a[3]=1;
  25. a[4]=1;
  26. a[5]=1;
  27. int ran,d=0;
  28. int e[101];
  29. for(int i=0;i<101;i++)
  30. {
  31. e[i]=0;
  32. }
  33. srand(time(NULL));
  34. SYSTEMTIME Time;
  35. Sleep(10000);
  36. unsigned long long int StartTick;
  37. // ofstream b;
  38. // b.open("systime_madry.txt");
  39. // GetSystemTime(&Time);
  40. // b<<Time.wHour<<":"<<Time.wMinute<<":"<<Time.wSecond<<":"<<Time.wMilliseconds<<endl;
  41. cout<<"\a";
  42. StartTick=GetTickCount();
  43. while(!(a[0]==0 && a[1]==0 && a[2]==0 && a[3]==0 && a[4]==0 && a[5]==0))
  44. {
  45. ran=rand()%4;
  46. ran++;
  47. switch(ran)
  48. {
  49. case 1:
  50. a[1]=!a[1];
  51. a[2]=!a[2];
  52. break;
  53. case 2:
  54. a[2]=!a[2];
  55. a[3]=!a[3];
  56. a[4]=!a[4];
  57. a[5]=!a[5];
  58. break;
  59. case 3:
  60. a[0]=!a[0];
  61. a[3]=!a[3];
  62. break;
  63. case 4:
  64. a[0]=!a[0];
  65. a[1]=!a[1];
  66. a[4]=!a[4];
  67. break;
  68.  
  69. }
  70. e[d]=ran;
  71. if(d==100)
  72. {
  73. d=0;
  74. a[0]=0;
  75. a[1]=0;
  76. a[2]=0;
  77. a[3]=1;
  78. a[4]=1;
  79. a[5]=1;
  80. for(int i=0;i<101;i++)
  81. {
  82. e[i]=0;
  83. }
  84. }
  85. else d++;
  86. if(c[0]==longlongmax){c[1]++;c[0]=0;gowno<<"a";gowno.flush();}
  87. if(c[1]==longlongmax){c[2]++;c[1]=0;}
  88. if(c[2]==longlongmax){c[3]++;c[2]=0;}
  89. if(c[3]==longlongmax){c[4]++;c[3]=0;}
  90. if(c[4]==longlongmax){c[5]++;c[4]=0;}
  91. if(c[5]==longlongmax){c[6]++;c[5]=0;}
  92. if(c[6]==longlongmax){gowno<<"przepelnienie\n";gowno.flush();}
  93. c[0]++;
  94. if(GetTickCount()-StartTick>10000){gowno<<c[0]<<'\n';gowno.flush();}
  95.  
  96. }
  97. // GetSystemTime(&Time);
  98. // b<<Time.wHour<<":"<<Time.wMinute<<":"<<Time.wSecond<<":"<<Time.wMilliseconds;
  99. Beep(500,5000);
  100. for(int i=0;i<6;i++)
  101. {
  102. cout<<a[i]<<" ";
  103. }
  104. ofstream cos;
  105. cos.open("UDALO_SIE.txt");
  106. for(int i=0;i<101;i++)
  107. {
  108. cos<<e[i]<<endl;
  109. }
  110. cos.close();
  111. //b.close();
  112. gowno.close();
  113. system("pause>>NULL");
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement