title: fill an array with Int like a Char; C++, cin object
body: <p>This is a pretty simple question; first time poster and long time looker.</p>
  
  <p>Here is my binary to decimal converter I wrote:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  const int MAX = 6;
  int conv(int z[MAX], int l[6], int MAX);
  
  int main()
  {
      int zelda[MAX];
      const int d = 6;
      int link[d];
  
      cout &lt;&lt; "Enter a binary number: \n";  
      int i = 0;
      while (i &lt; MAX &amp;&amp; (cin &gt;&gt; zelda[i]).get())  //input loop
      {
          ++i;
      }   
  
      cout &lt;&lt; conv(zelda, link, MAX);
  
      cin.get();
      return  0;
  }
  
  int conv(int zelda[MAX], int link[6], int MAX)
  {   
      int sum = 0;
      for (int t = 0; t &lt; MAX; t++)
      {
          long int h, i;
          for (int h = 5, i = 0; h &gt;= 0; --h, ++i)
              if (zelda[t] == 1)
                  link[h] = pow(2.0, i);
              else
                  link[h] = 0;
              sum += link[t]; 
      }
      return sum;
  }
  </code></pre>
  
  <p>With the way the input loop is being handled, I have to press enter after each input of a number.  I haven't added any error correction yet either (and some of my variables are vague), but would like to enter a binary say 111111 instead of 1 enter, 1 enter, 1 enter, etc to fill the array.  I am open to any technique and other suggestions.  Maybe input it as a string and convert it to an int?</p>
  
  <p>I will keep researching.  Thanks. </p>