title: Why is my code doesn't print the invalid value to inform the user?
body: <p>In this program I'm trying to print the single value which is identified as invalid by the program.
  For example the any non-digit value is invalid and the program must print it along an error message which is defined.
  My code:</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  void Welcome();
  void botVerification();
  bool isNumber(string botV);
  int main ()
  {
      Welcome();
      botVerification();
      botVerification();
      botVerification();
      return 0;
  }
  void Welcome()
  {
      cout &lt;&lt; &quot;Welcome to our program&quot; &lt;&lt; '\n';
  }
  void botVerification()
  {
      string botV;
      cout &lt;&lt; &quot;Enter the number to start the Calculator: &quot;;
      cin &gt;&gt; botV;
      if(isNumber(botV))
          cout &lt;&lt; &quot;Success&quot; &lt;&lt; '\n';
      else
          cout &lt;&lt; &quot;Not success &quot; &lt;&lt; '\n';
  }
  bool isNumber(string botV)
  {
      int badIndex = 0;
      for (int bcounter = 0; bcounter &lt; botV.length(); bcounter++)
          if (!(botV[bcounter] &gt;=48 &amp;&amp; botV[bcounter] &lt;= 57))
              {
                return false;
                badIndex = bcounter;
                cout &lt;&lt; &quot;Not success &quot; &lt;&lt; botV[badIndex] &lt;&lt; &quot; is not a number &quot;&lt;&lt; '\n';
                break;
              }
          return true;
  }
  </code></pre>