title: C++ Syntax Error - Cannot Identify Issue
body: <p>I am new to C++ and having some trouble understanding the behaviour of it as it is quite different from the other languages I have studied.</p>
  
  <p>Could someone please point me in the right direction to fix this code and explain the error logs?</p>
  
  <p>I am using <a href="http://www.compileonline.com/compile_cpp_online.php" rel="nofollow">http://www.compileonline.com/compile_cpp_online.php</a> to compile and run this code.</p>
  
  <p>An array(vector) variable is declared of size 5, and then a for loop inside of a while loop will fill it and change the values. On the first loop of the while, the for loop fills it, if the first value entered is -1 the while loop should stop. Otherwise keep allowing the user to change the values.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;vector&gt;
  
  using namespace std;
  
  int main()
  {
      vector&lt;int&gt; items(5); 
  
      do
      {
          cout &lt;&lt; "Type customer details: " &lt;&lt; endl;
  
          for(int i = 0; i &lt; 5; i++)
          {
              cout &lt;&lt; "info " &lt;&lt; 0 &lt;&lt; ": ";
  
              items[i] &gt;&gt; cin;
          }
  
          int newBalance = items[1] + items[2] - items[3];
  
          if(newBalance &gt; items[4])
          {
              cout &lt;&lt; items[0] &lt;&lt; " - " &lt;&lt; items[4] &lt;&lt; " - " &lt;&lt; newBalance &lt;&lt; " - Credit limit exceeded." &lt;&lt; endl;
          }
  
      }while(items[0] != -1);
  }
  </code></pre>
  
  <p>Error Log:</p>
  
  <pre><code>Compiling the source code....
  $g++ main.cpp -o demo -lm -pthread -lgmpxx -lgmp -lreadline 2&gt;&amp;1
  main.cpp: In function 'int main()':
  main.cpp:18:13: error: no match for 'operator&gt;&gt;' (operand types are 'int' and     'std::istream {aka std::basic_istream&lt;char&gt;}')
  items[i] &gt;&gt; cin;
  ^
  main.cpp:18:13: note: candidates are:
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/string:53:0,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/locale_classes.h:40,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/ios_base.h:41,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/ios:42,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/ostream:38,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:39,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/basic_string.tcc:996:5: note:     template&lt;class _CharT, class _Traits, class _Alloc&gt; std::basic_istream&lt;_CharT, _Traits&gt;&amp;     std::operator&gt;&gt;(std::basic_istream&lt;_CharT, _Traits&gt;&amp;,     std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;)
  operator&gt;&gt;(basic_istream&lt;_CharT, _Traits&gt;&amp; __in,
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/basic_string.tcc:996:5: note: template     argument deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;_CharT, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:879:0,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/istream.tcc:955:5: note: template&lt;class     _CharT2, class _Traits2&gt; std::basic_istream&lt;_CharT, _Traits&gt;&amp;     std::operator&gt;&gt;(std::basic_istream&lt;_CharT, _Traits&gt;&amp;, _CharT2*)
  operator&gt;&gt;(basic_istream&lt;_CharT, _Traits&gt;&amp; __in, _CharT* __s)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/istream.tcc:955:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;_CharT, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:879:0,
  from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/istream.tcc:923:5: note: template&lt;class     _CharT, class _Traits&gt; std::basic_istream&lt;_CharT, _Traits&gt;&amp;     std::operator&gt;&gt;(std::basic_istream&lt;_CharT, _Traits&gt;&amp;, _CharT&amp;)
  operator&gt;&gt;(basic_istream&lt;_CharT, _Traits&gt;&amp; __in, _CharT&amp; __c)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/istream.tcc:923:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;_CharT, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40:0,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:727:5: note: template&lt;class     _Traits&gt;     std::basic_istream&lt;char, _Traits&gt;&amp; std::operator&gt;&gt;(std::basic_istream&lt;char,     _Traits&gt;&amp;, unsigned char&amp;)
  operator&gt;&gt;(basic_istream&lt;char, _Traits&gt;&amp; __in, unsigned char&amp; __c)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:727:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;char, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40:0,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:732:5: note: template&lt;class _Traits&gt;     std::basic_istream&lt;char, _Traits&gt;&amp; std::operator&gt;&gt;(std::basic_istream&lt;char,     _Traits&gt;&amp;, signed char&amp;)
  operator&gt;&gt;(basic_istream&lt;char, _Traits&gt;&amp; __in, signed char&amp; __c)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:732:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;char, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40:0,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:774:5: note: template&lt;class _Traits&gt;     std::basic_istream&lt;char, _Traits&gt;&amp; std::operator&gt;&gt;(std::basic_istream&lt;char,     _Traits&gt;&amp;, unsigned char*)
  operator&gt;&gt;(basic_istream&lt;char, _Traits&gt;&amp; __in, unsigned char* __s)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:774:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;char, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:40:0,
  from main.cpp:1:
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:779:5: note: template&lt;class _Traits&gt;     std::basic_istream&lt;char, _Traits&gt;&amp; std::operator&gt;&gt;(std::basic_istream&lt;char,     _Traits&gt;&amp;, signed char*)
  operator&gt;&gt;(basic_istream&lt;char, _Traits&gt;&amp; __in, signed char* __s)
  ^
  /usr/local/gcc-4.8.1/include/c++/4.8.1/istream:779:5: note: template argument     deduction/substitution failed:
  main.cpp:18:16: note: mismatched types 'std::basic_istream&lt;char, _Traits&gt;' and 'int'
  items[i] &gt;&gt; cin;
  ^
  </code></pre>