Advertisement
__RIK__

Untitled

Oct 15th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. // testcount.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include <ctime>
  7.  
  8. int main()
  9. {
  10.     srand(time(0));
  11.     int c[18];
  12.     int z;
  13.     for (z = 0; z <= 17; z++) c[z] = 0;
  14.     int k = 2;
  15.     int i = 0;
  16.     int comp = 0;
  17.     int cube1 = 0;
  18.     int cube2 = 0;
  19.     int j;
  20.     j = ((c[0] >= k) && (c[1] >= k) && (c[2] >= k) && (c[3] >= k) && (c[4] >= k) && (c[5] >= k) && (c[6] >= k) && \
  21.         (c[7] >= k) && (c[8] >= k) && (c[9] >= k) && (c[10] >= k) && (c[11] >= k) && (c[12] >= k) && (c[13] >= k) && \
  22.         (c[14] >= k) && (c[15] >= k) && (c[16] >= k) && (c[17] >= k));
  23.     for (i = 1; j == 0; i++) {
  24.         cube1 = rand() % 6 + 1;
  25.         cube2 = rand() % 6 + 1;
  26.         comp = cube1 * cube2;
  27.         if (comp == 1) c[0]++;
  28.         else if (comp == 2) c[1]++;
  29.             else if (comp == 3) c[2]++;
  30.                 else if (comp == 4) c[3]++;
  31.                     else if (comp == 5) c[4]++;
  32.                         else if (comp == 6) c[5]++;
  33.                             else if (comp == 8) c[6]++;
  34.                                 else if (comp == 9) c[7]++;
  35.                                     else if (comp == 10) c[8]++;
  36.                                         else if (comp == 12) c[9]++;
  37.                                             else if (comp == 15) c[10]++;
  38.                                                 else if (comp == 16) c[11]++;
  39.                                                     else if (comp == 18) c[12]++;
  40.                                                         else if (comp == 20) c[13]++;
  41.                                                             else if (comp == 24) c[14]++;
  42.                                                                 else if (comp == 25) c[15]++;
  43.                                                                     else if (comp == 30) c[16]++;
  44.                                                                         else if (comp == 36) c[17]++;
  45.         j = ((c[0] >= k) && (c[1] >= k) && (c[2] >= k) && (c[3] >= k) && (c[4] >= k) && (c[5] >= k) && (c[6] >= k) && \
  46.             (c[7] >= k) && (c[8] >= k) && (c[9] >= k) && (c[10] >= k) && (c[11] >= k) && (c[12] >= k) && (c[13] >= k) && \
  47.             (c[14] >= k) && (c[15] >= k) && (c[16] >= k) && (c[17] >= k));
  48.         printf("%d %d %d %d %d \n", i, cube1, cube2, comp, j);
  49.     }
  50.     for (i = 0; i <= 17; i++) printf("%d ", c[i]);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement