Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <cstring>
  4. #include <time.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int hour, coeff=90;
  12. char minut;
  13. srand (time (NULL));
  14.  
  15. for(hour=0; hour<=24; hour= hour+4)
  16. {
  17. switch (hour){
  18. case 0:
  19. if (coeff<rand () % 100 + 1)
  20. cout<<"game over";
  21.  
  22. else
  23. coeff=coeff-5;
  24. break;
  25. case 4:
  26. if (coeff<rand () % 100 + 1)
  27. cout<<"game over";
  28.  
  29. else
  30. coeff=coeff-5;
  31. break;
  32. case 8:
  33. if (coeff<rand () % 100 + 1)
  34. cout<<"game over";
  35.  
  36. else
  37. coeff=coeff-5;
  38. break;
  39. case 12:
  40. if (coeff<rand () % 100 + 1)
  41. cout<<"game over";
  42.  
  43. else
  44. coeff=coeff-5;
  45. break;
  46. case 16:
  47. if (coeff<rand () % 100 + 1)
  48. cout<<"game over";
  49.  
  50. else
  51. coeff=coeff-5;
  52. break;
  53. case 20:
  54. if (coeff<rand () % 100 + 1)
  55. cout<<"game over";
  56.  
  57. else
  58. coeff=coeff-5;
  59. break;
  60. case 24:
  61. if (coeff<rand () % 100 + 1)
  62. cout<<"game over";
  63.  
  64. else
  65. coeff=coeff-5;
  66. break;
  67. default: cerr << "error\n";
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement