title: C++ making each decimal in a double into array elements?
body: <p>(This is for an exercise) I'm trying to create a program that takes a double like 1.2041 and makes each decimal into an element in an array. </p>
  
  <p>Through a loop I want the array to end up like this: <code>ar[0] = 0.2; ar[1] = 0.00;  ar[2] = 0.004;  ar[3] = 0.0001;</code></p>
  
  <p>After that I'm going to add the decimals together and end up with 0,2041 but I can't seem to find any way to reach out to each decimal alone.</p>
  
  <p>I tried with multiplying and subtracting but I can't seem to get it to work.</p>
  
  <p>Anyone know a simple way of making each decimal in a double into their own separate elements in an array?</p>