title: class std::vector<...> has no member named
body: <p>I'm pretty new to C++, and I'm trying to use a vector of structs,
  but I keep getting "class std::vector’ has no member named ‘p’" when I try to compile my code. This is it, by the way:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;cstdlib&gt;
  #include &lt;stdio.h&gt;
  #include &lt;algorithm&gt;
  using namespace std;
  
  struct animal {
      int p;
      int v;
  };
  
  
  bool cmpp (animal a, animal b) { 
      return (a.p &lt; b.p); 
  }
  
  bool cmpv (animal a, animal b) { 
      return (a.v &lt; b.v); 
  }
  
  bool cmpc (pair&lt;animal, animal&gt; a, pair&lt;animal, animal&gt; b) { 
      return (a.first.p &lt; b.first.p); 
  }
  
  int main(){
      int c, s;
      while(scanf("%d %d", &amp;c, &amp;s) != EOF){
          vector&lt;animal&gt; masses[2*c];
          vector&lt;pair&lt;animal, animal&gt; &gt; chamber;
  
          for (int i = 0; i &lt; 2*c-s; i++){
              masses[i].v = 0;
              masses[i].p = -1;
          }
  
          for (int i = 2*c-s; i &lt; 2*c; i++){
              masses[i].v &lt;&lt; cin;
              masses[i].p &lt;&lt; i - 2*c-s;
          }
  
          sort(masses.begin(), masses.end(), cmpv);
  
          for(int i = 0; i &lt; c; i++){
              if(chamber[i].p &lt; masses[2*c-i] &amp;&amp; chamber[i].p != -1)
                  chamber[i] = pair&lt;animal, animal&gt; (masses[i], masses[2*c-i]);
              else
                  chamber[i] = pair&lt;animal, animal&gt; (masses[2*c-i], masses[i]);
          }
  
          sort(chamber.begin(), chamber.end(), cmpc);
  
          for(int i = 0; i &lt; c; i++){
              printf("%d %d", chamber[i].first.v, chamber[i].second.v)
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>There might be other errors in the code, but I just wanna know the vector thing for now.
  P.S.: This is my first question here :) I knew this day would come!</p>