title: Need help to sort out the errors
body: <p>I am a bit new to C++ and using linux platform with g++ as compiler.The mix of the above three have left me mired.</p>
  
  <p>Here is the (very simple) program:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  
  using namespace std;
  
  class string
  {
  private:
      char str[20];
  public:
      string()
      {
          str[0]='\0';
      }
      string(char*s)
      {
          strcpy(str,s);
      }
      string(int a)
      {
          itoa(a,str,10);
      }
      operator int()//overloaded cast operator,converts string to int
      {
          int i=0,l,ss=0,k=1;
          for(i=strlen(str)-1;i&gt;=0;i--)
          {
              ss=ss+(str[i]-48)*k;
              k=k*10;
          }
          return ss;
      }
      void displayData()
      {
          cout&lt;&lt;str;
      }
  };
  
  int main()
  {
      string s1=123;
      cout&lt;&lt;endl&lt;&lt;"s1=";
      s1.displayData();
  
      s1=150;
      cout&lt;&lt;endl&lt;&lt;"s1=";
      s1.displayData();
  
      string s2("123");
      int i=int(s2);
      cout&lt;&lt;endl&lt;&lt;"i="&lt;&lt;i;
  
      string s3("456");
      i=s3;
      cout&lt;&lt;endl&lt;&lt;"i="&lt;&lt;i;
  }
  </code></pre>
  
  <p>The errors I am getting</p>
  
  <pre><code>naveen@linuxmint ~/Desktop/C++ $ g++ int2string.cpp -o int2string
  int2string.cpp: In constructor ‘string::string(int)’:
  int2string.cpp:22:16: error: ‘itoa’ was not declared in this scope
  int2string.cpp: In function ‘int main()’:
  int2string.cpp:42:2: error: reference to ‘string’ is ambiguous
  int2string.cpp:7:7: error: candidates are: class string
  In file included from /usr/include/c++/4.7/iosfwd:41:0,
                   from /usr/include/c++/4.7/ios:39,
                   from /usr/include/c++/4.7/ostream:40,
                   from /usr/include/c++/4.7/iostream:40,
                   from int2string.cpp:1:
  /usr/include/c++/4.7/bits/stringfwd.h:65:33: error:                 typedef class std::basic_string&lt;char&gt; std::string
  int2string.cpp:42:9: error: expected ‘;’ before ‘s1’
  int2string.cpp:44:2: error: ‘s1’ was not declared in this scope
  int2string.cpp:50:2: error: reference to ‘string’ is ambiguous
  int2string.cpp:7:7: error: candidates are: class string
  In file included from /usr/include/c++/4.7/iosfwd:41:0,
                   from /usr/include/c++/4.7/ios:39,
                   from /usr/include/c++/4.7/ostream:40,
                   from /usr/include/c++/4.7/iostream:40,
                   from int2string.cpp:1:
  /usr/include/c++/4.7/bits/stringfwd.h:65:33: error:                 typedef class std::basic_string&lt;char&gt; std::string
  int2string.cpp:50:9: error: expected ‘;’ before ‘s2’
  int2string.cpp:51:12: error: ‘s2’ was not declared in this scope
  int2string.cpp:54:2: error: reference to ‘string’ is ambiguous
  int2string.cpp:7:7: error: candidates are: class string
  In file included from /usr/include/c++/4.7/iosfwd:41:0,
                   from /usr/include/c++/4.7/ios:39,
                   from /usr/include/c++/4.7/ostream:40,
                   from /usr/include/c++/4.7/iostream:40,
                   from int2string.cpp:1:
  /usr/include/c++/4.7/bits/stringfwd.h:65:33: error:                 typedef class std::basic_string&lt;char&gt; std::string
  int2string.cpp:54:9: error: expected ‘;’ before ‘s3’
  int2string.cpp:55:4: error: ‘s3’ was not declared in this scope
  </code></pre>
  
  <p>I think I am not using the correct header file name and hence there is an ambiguity.Please help</p>