title: I have been trying to make a program in C++ that converts fahrenheit to celsius and vice versa using classes and objects
body: <p>I would just like to point out that I am new to the boards, so I am sorry if I do something wrong. I am also new to <code>c++</code>. I have programmed in <code>c</code> before, so the only thing that I am really having trouble with is object oriented programming. I am trying to apply it to a program. I know how to make this program using functions and a <code>switch</code> statement, but I am trying to apply object oriented programming to this program idea.</p>
  
  <p>I would like to use a <code>float</code> type so that decimals can be entered and printed, but I would be fine using <code>integers</code>.</p>
  
  <p>When I run the program, I get extremely larger numbers that do not make sense. These numbers are never the same. Sorry for my lack of comments:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  
  using namespace std;
  
  class Celsius{
  public:
      float setValue(float c){
          value = c;
      }
      float changeValue(float value){
          returnValue = value * 9 / 5 + 32;
      }
      float getValue(){
          return returnValue;
      }
  private:
      float value;
      float returnValue;
  };
  
  class Fahrenheit{
  public:
      float setValue(float f){
          value = f;
      }
      float changeValue(float value){
          returnValue = (value - 32)*5/9;
          cout &lt;&lt; returnValue;
      }
      float getValue(){
          return returnValue;
      }
  private:
      float value;
      float returnValue;
  };
  
  
  int main()
  {
      char type;
      float value1;
  
      cout &lt;&lt; "Do have a celsius or fahrenheit degree? (Press c for celsius and f for fahrenheit.) ";
      cin &gt;&gt; type;
      cout &lt;&lt; "Enter a temperature value: ";
      cin &gt;&gt; value1;
  
      if(type == 'C' || type == 'c'){
          Celsius metricObject;
          metricObject.setValue(value1);
          cout &lt;&lt; "In Fahrenheit, that is: " &lt;&lt; metricObject.getValue();
      }
      else if(type == 'F' || type == 'f'){
          Fahrenheit englishObject;
          englishObject.setValue(value1);
          cout &lt;&lt; "In celsius, that is: " &lt;&lt; englishObject.getValue();
  
      }
      else{
          return(0);
      }
      return(0);
  }
  </code></pre>