Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <time.h>
- #include <windows.h>
- #include <fstream>
- #include <iostream>
- #define longlongmax 18446744073709551615
- using namespace std;
- int main()
- {
- ofstream gowno;
- gowno.open("gowno_madry.txt");
- unsigned long long int c[7];
- c[0]=0;
- c[1]=0;
- c[2]=0;
- c[3]=0;
- c[4]=0;
- c[5]=0;
- c[6]=0;
- bool a[6];
- a[0]=0;
- a[1]=0;
- a[2]=0;
- a[3]=1;
- a[4]=1;
- a[5]=1;
- int ran,d=0;
- int e[101];
- for(int i=0;i<101;i++)
- {
- e[i]=0;
- }
- srand(time(NULL));
- SYSTEMTIME Time;
- Sleep(10000);
- unsigned long long int StartTick;
- // ofstream b;
- // b.open("systime_madry.txt");
- // GetSystemTime(&Time);
- // b<<Time.wHour<<":"<<Time.wMinute<<":"<<Time.wSecond<<":"<<Time.wMilliseconds<<endl;
- cout<<"\a";
- StartTick=GetTickCount();
- while(!(a[0]==0 && a[1]==0 && a[2]==0 && a[3]==0 && a[4]==0 && a[5]==0))
- {
- ran=rand()%4;
- ran++;
- switch(ran)
- {
- case 1:
- a[1]=!a[1];
- a[2]=!a[2];
- break;
- case 2:
- a[2]=!a[2];
- a[3]=!a[3];
- a[4]=!a[4];
- a[5]=!a[5];
- break;
- case 3:
- a[0]=!a[0];
- a[3]=!a[3];
- break;
- case 4:
- a[0]=!a[0];
- a[1]=!a[1];
- a[4]=!a[4];
- break;
- }
- e[d]=ran;
- if(d==100)
- {
- d=0;
- a[0]=0;
- a[1]=0;
- a[2]=0;
- a[3]=1;
- a[4]=1;
- a[5]=1;
- for(int i=0;i<101;i++)
- {
- e[i]=0;
- }
- }
- else d++;
- if(c[0]==longlongmax){c[1]++;c[0]=0;gowno<<"a";gowno.flush();}
- if(c[1]==longlongmax){c[2]++;c[1]=0;}
- if(c[2]==longlongmax){c[3]++;c[2]=0;}
- if(c[3]==longlongmax){c[4]++;c[3]=0;}
- if(c[4]==longlongmax){c[5]++;c[4]=0;}
- if(c[5]==longlongmax){c[6]++;c[5]=0;}
- if(c[6]==longlongmax){gowno<<"przepelnienie\n";gowno.flush();}
- c[0]++;
- if(GetTickCount()-StartTick>10000){gowno<<c[0]<<'\n';gowno.flush();}
- }
- // GetSystemTime(&Time);
- // b<<Time.wHour<<":"<<Time.wMinute<<":"<<Time.wSecond<<":"<<Time.wMilliseconds;
- Beep(500,5000);
- for(int i=0;i<6;i++)
- {
- cout<<a[i]<<" ";
- }
- ofstream cos;
- cos.open("UDALO_SIE.txt");
- for(int i=0;i<101;i++)
- {
- cos<<e[i]<<endl;
- }
- cos.close();
- //b.close();
- gowno.close();
- system("pause>>NULL");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement