title: Error with C++ Program
body: <p>I am currently taking a C++ class, so bear with me. I am not asking for you to solve my homework, but just simply help me figure out what I am overlooking
  I am converting Roman numerals that the user inputs into a decimal number and then displaying the number. I have not completed my function for conversion yet. For now, I just convert the numeral into a number and add them up (Not taking into account on the order yet). I keep getting a 0 and not the right number whenever I run the program. Here is my code for the header file:</p>
  
  <pre><code>class romanType
      {
      public:
          void setNumeral(string);
          string getNumeral();
          double convertToNumber();
          double printNumber();
      private:
          string input;
          double num;
      };
  
  void romanType::setNumeral(string s)
  {
      string input = s;
  }
  
  string romanType::getNumeral()
  {
      return input;
  }
  
  double romanType::convertToNumber()
  {
      num = 0;
      for(int i = 0; i &lt; input.length(); i++)
      {
          switch (input.at(i))
          {
          case 'M':
              num += 1000;
              break;
          case 'D':
              num += 500;
              break;
          case 'C':
              num += 100;
              break;
          case 'L':
              num += 50;
              break;
          case 'X':
              num += 10;
              break;
          case 'V':
              num += 5;
              break;
          case 'I':
              num += 1;
              break;
          }
      }
      return num;
  }
  
  double romanType::printNumber()
  {
      return num;
  }
  </code></pre>
  
  <p>Here is my cpp file code:</p>
  
  <pre><code>#include "stdafx.h"
  #include "romanType.h"
  #include &lt;string&gt;
  #include &lt;cstring&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      romanType roman;
      string input;
      string output;
      double number = 0;
      cout &lt;&lt; "Enter a Roman numeral." &lt;&lt; endl;
      cin &gt;&gt; input;
      roman.setNumeral(input);
      number = roman.convertToNumber();
      cout &lt;&lt; number &lt;&lt; endl;
  
      system("pause");
      return 0;
  }
  </code></pre>