fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. srand( time( 0 ) );
  10. int w=0;
  11. int p=0;
  12.  
  13. for(int x=1;x<6;x++){
  14. int a=rand()%2; if(a==1){w++;}
  15. int b=rand()%2; if(b==1){w++;}
  16. int c=rand()%2; if(c==1){w++;}
  17. int d=rand()%2; if(d==1){w++;}
  18. int e=rand()%2; if(e==1){w++;}
  19. int f=rand()%2; if(f==1){w++;} else{p++;}
  20.  
  21. cout<<a<<b<<c<<d<<e<<" "<<w<<p<<endl;
  22.  
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 15224KB
stdin
Standard input is empty
stdout
00111   40
01100   70
01001   100
10010   130
01111   180