title: C++ Issue passing String value to Implementation file
body: <p>Having troubles with a homework assignment. C++ is not my best language and I'm struggling with the class especially with the concept of classes. I think I have mostly worked the code out for the assignment, but I have am having difficulties passing the string romanString2 from the main file to the implementation file so it reaches void romanType::romanToPositiveInteger() {}. Below is my current code. I would appreciate assistance in pointing what is wrong. </p>
  
  <p>main.cpp
  //Main program</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "roman.h" 
  
  using namespace std;
  
  int main()
  {
      romanType roman;
  
      string romanString2;
  
      cout &lt;&lt; "Enter a roman number: ";
      cin &gt;&gt; romanString2;
      cout &lt;&lt; endl;
       roman.setRoman(romanString2);
  
      cout &lt;&lt; "The equivalent of the Roman numeral "
           &lt;&lt; romanString2 &lt;&lt; " is ";
      roman.printPositiveInteger();
     // cout &lt;&lt; numResult;
      cout &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>roman.cpp
  //Roman Number Implementation file</p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include &lt;string&gt;
  #include "roman.h"
  
  using namespace std;
  
  // part c
  void romanType::printPositiveInteger() const { 
  cout &lt;&lt; num; 
  }
  
  // part c
  void romanType::printRoman() const {
  cout &lt;&lt; romanNum;
  }
  
  // part a
  void romanType::setRoman(string rString) {
      romanNum = rString;
       romanToPositiveInteger(); 
  }
  
  // part b
  void romanType::romanToPositiveInteger() {
  
      int numResult;
      string romanString;
      numResult = 0;
  
     cout &lt;&lt; romanString;
      if (romanString.find("MMM") != std::string::npos) {
     numResult = numResult + 3000;
  }else if (romanString.find("MM") != std::string::npos){
           numResult = numResult + 2000;
      }else if (romanString.find("M") != std::string::npos and romanString.find("CM") == std::string::npos){
  
           numResult = numResult + 1000;
      }else{
  
      }
      if (romanString.find("CM") != std::string::npos){
          numResult = numResult + 900;
          cout &lt;&lt; "CM";
      }
         if (romanString.find("D") != std::string::npos and romanString.find("CD") == std::string::npos) {
     numResult = numResult + 500;
  }
  
       if (romanString.find("CD") != std::string::npos){
          numResult = numResult + 400;
      }
  
             if (romanString.find("C") != std::string::npos and romanString.find("CD") == std::string::npos and romanString.find("CC") == std::string::npos  and romanString.find("CCC") == std::string::npos and romanString.find("CM") == std::string::npos  ) {
     numResult = numResult + 100;
  }
          if (romanString.find("CCC") != std::string::npos) {
     numResult = numResult + 300;
  }else if (romanString.find("CC") != std::string::npos){
           numResult = numResult + 200;
      }
  
                if (romanString.find("L") != std::string::npos and romanString.find("LC") == std::string::npos) {
     numResult = numResult + 50;
  }
      if(romanString.find("XL") != std::string::npos) {
     numResult = numResult + 40;
  }
          if (romanString.find("XXX") != std::string::npos) {
     numResult = numResult + 30;
  }else if (romanString.find("XX") != std::string::npos){
           numResult = numResult + 20;
      }else if (romanString.find("X") != std::string::npos and romanString.find("IX") == std::string::npos){
  
           numResult = numResult + 10;
      }else{
  
      } 
        if (romanString.find("IX") != std::string::npos){
          numResult = numResult + 9;
      } 
        if (romanString.find("V") != std::string::npos and romanString.find("IV") == std::string::npos ){
          numResult = numResult + 5;
      } 
          if (romanString.find("III") != std::string::npos) {
     numResult = numResult + 3;
  }else if (romanString.find("II") != std::string::npos){
           numResult = numResult + 2;
      }else if (romanString.find("I") != std::string::npos and romanString.find("IV") == std::string::npos){
  
           numResult = numResult + 1;
      }else{
  
      }
        if (romanString.find("IV") != std::string::npos){
          numResult = numResult + 4;
      } 
      cout &lt;&lt; numResult;
       num = numResult;
  }
  
  romanType::romanType() { 
  romanNum ='I';
      num='1';
  
  }
  
  romanType::romanType(string rString) { 
      romanNum = rString;
       romanToPositiveInteger();
  }
  </code></pre>
  
  <p>roman.h</p>
  
  <pre><code>#include &lt;string&gt; 
  using namespace std;
  
  class romanType
  {
  public:
      void setRoman(string);
      void romanToPositiveInteger();
      void printPositiveInteger() const;
      void printRoman() const;
      romanType();
      romanType(string);
  
  
  private:
      string romanNum;
      int num;
  };
  </code></pre>