title: Division Function w/ Multiple Return Possibilities
body: <p>I'm working on a school assignment, but I'm having trouble with a problem.</p>
  <p>The problem is as follows:</p>
  <p>&quot;Write a function called divideIt that takes two integers, divides them, and returns the result as a float. Have this function skip division when it encounters an unacceptable value, and also retain the decimals. Do you know what to quit on?&quot;</p>
  <p>With the code I currently have, it divides and retains the decimal like the problem states, but I don't understand how to skip division. If I skip division because of an unacceptable value, what do I place in return? Should I just use null? Also, I'm not sure about the &quot;Do you know what to quit on?&quot; line.</p>
  <p><strong>My Code:</strong></p>
  <pre><code>#include &lt;iostream&gt;
  
  
  using std::cout;
  using std::cin;
  using std::endl;
  
  
  //Prototype
  
  float divideIt(int num1, int num2);
  
  int main()
  {
      int num1, num2;
      float finalResult;
      finalResult = divideIt(num1, num2);
      cout &lt;&lt; &quot;Result: &quot; &lt;&lt; finalResult &lt;&lt; endl;
  }
  
  //Header
  
  float divideIt(int num1, int num2)
  {
      cout &lt;&lt; &quot;Simple Division\n&quot; &lt;&lt; &quot;Input first integer: &quot;;
      cin &gt;&gt; num1;
      cout &lt;&lt; &quot;Input second integer: &quot;;
      cin &gt;&gt; num2;
      if(num2 == 0) //I wanted to make ASCII values unacceptable, but because they automatically translated into zeros, so I used that to my advantage on num2.
      {
          cout &lt;&lt; &quot;The second value was undefined or unacceptable.&quot; &lt;&lt; endl;
      }
      return static_cast&lt;float&gt;(num1) / num2;
  }
  </code></pre>