title: segmentaion fault (core dumped)
body: <p>Hi I'm kind of new to C++ and i had to fill a code. The code should read as many values as given in the first input, afterwards it should compute the triple of the sum of these values.</p>
  
  <p>I tried it like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main(int argc, char* argv[])
  {
      if (argc != 2) {
          return 1;
      }
      int n = atoi(argv[1]);
      vector&lt;double&gt; x;
      for (int i = 0; i &lt; n; i++)
          cin &gt;&gt; x[i];
      double v = 0;
      for (int i = 0; i &lt; n; i++)
          v = 3 * x[i];
      cout &lt;&lt; v &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>Unfortunately I end up in a segmentation fault...
  Here is the <a href="https://i.stack.imgur.com/Dz3Db.png" rel="nofollow noreferrer">unfinished code</a></p>