title: C++ Program hangs when calling a function
body: <p>I have written a code which checks whether a integer is prime or not,whenever i am calling that function the command line just hangs.
  I am using MingW in Windows 7</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;math.h&gt;
  using namespace std;
  bool checkPrime(int n);
  int main()
  {
      int t,tempstart;
      cout&lt;&lt;checkPrime(6);
      return 0;
  }
  bool checkPrime(int n)
  {
      bool check=true;
      for (int i = 0; i &lt;(int) sqrt(n) ; i++)
      {
          if(n%i==0)
          {
              check=false;
              cout&lt;&lt;"asas";
              break;
          }
      }
      return check;
  }
  </code></pre>