title: Exceptions C++ in vector
body: <blockquote>
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;string&gt;
  using namespace std;
  vector&lt;char&gt; prime;
  char a='t';
  int number;
  int sqrt_of_n;
  int main(){
    try{
        cin &gt;&gt; number;
        sqrt_of_n = round(sqrt(number));
        for (int i = 0; i &lt; number; i++) prime.push_back(a);//заполнение массива
        for (int i = 2; i &lt; sqrt_of_n; i++)
        {
            for (int j = 3; j &lt; number; j++)
            {
                if ((j%i == 0) &amp;&amp; (j!=i)) prime[j] = 'f';
            }
        }
        for (int i = 0; i &lt;= prime.size(); i++)
        if (prime[i] == 't') cout &lt;&lt; i &lt;&lt; endl;
        system("pause");
    }
    catch (exception &amp;e){ cout &lt;&lt; "Isnt good" &lt;&lt; e.what() &lt;&lt; endl; }
  }
  </code></pre>
  </blockquote>
  
  <p>Some problems with catching exceptions. I want to catch a out_of_range error in vector, but it didnt work.Thanks</p>