title: C++ | Syntax Error: Identifier 'i'
body: <p>Hey guys, I'm pretty sure someone else has had this problem too, but I just couldn't find any related problems. This is also probably something really stupid like a typo or something, but I'm not able to figure it out >.&lt;</p>
  
  <p>What's wrong with the code, I always get this error:</p>
  
  <p>error C2061: syntax error : identifier 'i'</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class MahinLuokka {
      public:
          void setNum(int);
          int getNum();
      private:
          int mahi_num;
  };
  
  int main()
  {
      int i;
      do {
          cout &lt;&lt; "Insert number between 1-100" &lt;&lt; endl;
          cin &gt;&gt; i;
      } while i &gt; 100 || i &lt; 0;
      MahinLuokka mahi;
      mahi.setNum(i);
      cout &lt;&lt; mahi.getNum() &lt;&lt; endl;
      mahi.setNum(5);
      cout &lt;&lt; "mahi_num set to 5" &lt;&lt; endl;
      cout &lt;&lt; mahi.getNum() &lt;&lt; endl;
  
      // end
      int x;
      cin &gt;&gt; x;
      return 0;
  }
  
  void MahinLuokka::setNum(int number)
  {
      mahi_num = number;
  }
  
  int MahinLuokka::getNum()
  {
      return mahi_num;
  }
  </code></pre>