title: C++ DeathPrediction - first program how to add precentage in for loop
body: <p>I decided for my first C++ project, and I would make a death predictor that would have accurate death chances and would give you a birthday in which you would keep getting birthday's every 360 miliseconds until you eventually die.</p>
  
  <p>The problem I'm facing is I don't know how to incorporate the precentage charts to my work.
  I added only 1 of the 19 <code>if</code> statements, because 600 lines of code on the thread would be a pain to nagivate through. How do I incorporate these precentage charts to make the program work?</p>
  
  <pre><code>//GOOOD LUCK
  #include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;cmath&gt;
  #include &lt;string&gt;
  #include &lt;Windows.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;random&gt;
  
  using namespace std;
  
  int main()
  {
      random_device rd;
      mt19937 gen(rd());
  
      uniform_int_distribution&lt;&gt; dis1 (1,28440);         // Died under 1 year of
      //age.  1.161756638 % chance
  
      uniform_int_distribution&lt;&gt; dis2 (28441,33196);     // Died between 1-4 years of
      //age.  0.194279696 % chance
  
      uniform_int_distribution&lt;&gt; dis3 (33197,36033);     // Died between 5-9 years of
      //age.  0.115889718 % chance
  
      uniform_int_distribution&lt;&gt; dis4 (36034,39798);     // Died between 10-14 years of
      //age.  0.153797951 % chance
  
      uniform_int_distribution&lt;&gt; dis5 (39799,53501);     // Died between 15-19 years of
      //age.  0.559759184 % chance
  
      uniform_int_distribution&lt;&gt; dis6 (53502,74032);     // Died between 20-24 years of
      //age.  0.838678816 % chance
  
      uniform_int_distribution&lt;&gt; dis7 (74033,93600);     // Died between 25-29 years of
      //age.  0.799340854 % chance
  
      uniform_int_distribution&lt;&gt; dis8 (93601,115957);    // Died between 30-34 years of
      //age.  0.913264801 % chance
  
      uniform_int_distribution&lt;&gt; dis9 (115958,147377);   // Died between 35-39 years of
      //age.  1.283487819 % chance
  
      uniform_int_distribution&lt;&gt; dis10(147378,200742);   // Died between 40-44 years of
      //age.  2.179927672 % chance
  
      uniform_int_distribution&lt;&gt; dis11(200743,280125);   // Died between 45-49 years of
      //age.  3.242747089 % chance
  
      uniform_int_distribution&lt;&gt; dis12(280126,384272);   // Died between 50-54 years of
      //age.  4.254341371 % chance
  
      uniform_int_distribution&lt;&gt; dis13(384273,511750);   // Died between 55-59 years of
      //age.  5.207398478 % chance
  
      uniform_int_distribution&lt;&gt; dis14(511751,659573);   // Died between 60-64 years of
      //age.  6.038474388 % chance
  
      uniform_int_distribution&lt;&gt; dis15(659574,831809);   // Died between 65-69 years of
      //age.  7.035735454 % chance
  
      uniform_int_distribution&lt;&gt; dis16(831810,1057928);  // Died between 70-74 years of
      //age.  9.236823110 % chance
  
      uniform_int_distribution&lt;&gt; dis17(1057929,1365816); // Died between 75-79 years of
      //age. 12.57703684 % chance
  
      uniform_int_distribution&lt;&gt; dis18(1365817,1744593); // Died between 80-84 years of
      //age. 15.47280922 % chance
  
      uniform_int_distribution&lt;&gt; dis19(1744594,2447762); // Died at age 85 and above.
      //     28.72402438 % chance
  
  
      //REFERENCE: http://www.disastercenter.com/cdc/Death%20rates%202005.html
  
  
      for (double count = 0; count &lt; 101; count++)
      {
          int var1 = dis1(gen);
          int var2 = dis2(gen);
          int var3 = dis3(gen);
          int var4 = dis4(gen);
          int var5 = dis5(gen);
          int var6 = dis6(gen);
          int var7 = dis7(gen);
          int var8 = dis8(gen);
          int var9 = dis9(gen);
          int var10 = dis10(gen);
          int var11 = dis11(gen);
          int var12 = dis12(gen);
          int var13 = dis13(gen);
          int var14 = dis14(gen);
          int var15 = dis15(gen);
          int var16 = dis16(gen);
          int var17 = dis17(gen);
          int var18 = dis18(gen);
          int var19 = dis19(gen);
  
          if (count &lt; 102)
          {
              Sleep(360);
              cout &lt;&lt; "\n\t\t    It's your birthday! You turned: " &lt;&lt; count;
  
          }
          if (var1 &gt; 1 &amp;&amp; var1 &gt; 28440)
          {
              cout &lt;&lt; "\n\n\n\t\t\tYou died! Better luck next time!";
              cout &lt;&lt; "\n\n     ";
              Sleep(1000);
              cout &lt;&lt; "T   "; Sleep(100);
              cout &lt;&lt; "H   "; Sleep(100);
              cout &lt;&lt; "A   "; Sleep(100);
              cout &lt;&lt; "N   "; Sleep(100);
              cout &lt;&lt; "K   "; Sleep(100);
              cout &lt;&lt; "S   "; Sleep(100);
              cout &lt;&lt; "    "; Sleep(100);
              cout &lt;&lt; "F   "; Sleep(100);
              cout &lt;&lt; "O   "; Sleep(100);
              cout &lt;&lt; "R   "; Sleep(100);
              cout &lt;&lt; "    "; Sleep(100);
              cout &lt;&lt; "P   "; Sleep(100);
              cout &lt;&lt; "L   "; Sleep(100);
              cout &lt;&lt; "A   "; Sleep(100);
              cout &lt;&lt; "Y   "; Sleep(100);
              cout &lt;&lt; "I   "; Sleep(100);
              cout &lt;&lt; "N   "; Sleep(100);
              cout &lt;&lt; "G   "; Sleep(100);
              cout &lt;&lt; "    "; Sleep(100);
              cout &lt;&lt; "\n\n\n\t\t\t  ";
              return 0;
  </code></pre>