Advertisement
__RIK__

Untitled

Oct 12th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.13 KB | None | 0 0
  1. SAFEARRAYBOUND sab[2];
  2.         sab[0].lLbound = 1; sab[0].cElements = 500;
  3.         sab[1].lLbound = 1; sab[1].cElements = 3;
  4.         saNames.parray = SafeArrayCreate(VT_VARIANT, 2, sab);
  5.  
  6.         int i=0;
  7.         int comp = 0;
  8.         int cube1 = 0;
  9.         int cube2 = 0;
  10.         int c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18;
  11.         c1 = c2 = c3 = c4 = c5 = c6 = c7 = c8 = c9 = c10 = c11 = c12 = c13 = c14 = c15 = c16 = c17 = c18 = 0;
  12.         while (c1 <= 3 && c2 <= 3 && c3 <= 3 && c4 <= 3 && c5 <= 3 && c6 <= 3 && c7 <= 3 && c8 <= 3 && c9 <= 3 && c10 <= 3\
  13.             && c11 <= 3 && c12 <= 3 && c13 <= 3 && c14 <= 3 && c15 <= 3 && c16 <= 3 && c17 <= 3 && c18 <= 3)
  14.         {
  15.             cube1 = rand() % 6 + 1;
  16.             cube2 = rand() % 6 + 1;
  17.             comp = cube1 * cube2;
  18.             i++;
  19.             if (comp = 1)
  20.             {
  21.                 c1++;
  22.             }
  23.             else
  24.             {
  25.                 if (comp = 2){
  26.                     c2++;
  27.                 }
  28.                 else
  29.                 {
  30.                     if (comp = 3)
  31.                     {
  32.                         c3++;
  33.                     }
  34.                     else
  35.                     {
  36.                         if (comp = 4)
  37.                         {
  38.                             c4++;
  39.                         }
  40.                         else
  41.                         {
  42.                             if (comp = 5)
  43.                             {
  44.                                 c5++;
  45.                             }
  46.                             else
  47.                             {
  48.                                 if (comp = 6)
  49.                                 {
  50.                                     c6++;
  51.                                 }
  52.                                 else
  53.                                 {
  54.                                     if (comp = 8)
  55.                                     {
  56.                                         c7++;
  57.                                     }
  58.                                     else
  59.                                     {
  60.                                         if (comp = 10)
  61.                                         {
  62.                                             c8++;
  63.                                         }
  64.                                         else
  65.                                         {
  66.                                             if (comp = 12)
  67.                                             {
  68.                                                 c9++;
  69.                                             }
  70.                                             else
  71.                                             {
  72.                                                 if (comp = 9)
  73.                                                 {
  74.                                                     c10++;
  75.                                                 }
  76.                                                 else
  77.                                                 {
  78.                                                     if (comp = 15)
  79.                                                     {
  80.                                                         c11++;
  81.                                                     }
  82.                                                     else
  83.                                                     {
  84.                                                         if (comp = 18)
  85.                                                         {
  86.                                                             c12++;
  87.                                                         }
  88.                                                         else
  89.                                                         {
  90.                                                             if (comp = 16)
  91.                                                             {
  92.                                                                 c13++;
  93.                                                             }
  94.                                                             else
  95.                                                             {
  96.                                                                 if (comp = 20)
  97.                                                                 {
  98.                                                                     c14++;
  99.                                                                 }
  100.                                                                 else
  101.                                                                 {
  102.                                                                     if (comp = 24)
  103.                                                                     {
  104.                                                                         c15++;
  105.                                                                     }
  106.                                                                     else
  107.                                                                     {
  108.                                                                         if (comp = 25)
  109.                                                                         {
  110.                                                                             c16++;
  111.                                                                         }
  112.                                                                         else
  113.                                                                         {
  114.                                                                             if (comp = 30)
  115.                                                                             {
  116.                                                                                 c17++;
  117.                                                                             }
  118.                                                                             else
  119.                                                                             {
  120.                                                                                 if (comp = 36)
  121.                                                                                 {
  122.                                                                                     c18++;
  123.                                                                                 }
  124.                                                                             }
  125.                                                                         }
  126.                                                                     }
  127.                                                                 }
  128.                                                             }
  129.                                                         }
  130.                                                     }
  131.                                                 }
  132.                                             }
  133.                                         }
  134.                                     }
  135.                                 }
  136.                             }
  137.                         }
  138.                     }
  139.                 }
  140.             }
  141.             wchar_t temp_str1[11]; // we assume that the maximal string length can be 10
  142.             wchar_t temp_str2[11];
  143.             wchar_t temp_str3[11];
  144.             _itow(cube1, temp_str1, 10);
  145.             _itow(cube2, temp_str2, 10);
  146.             _itow(comp, temp_str3, 10);
  147.             SafeArrayPutName(saNames.parray, i, temp_str1, temp_str2, temp_str3);
  148.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement