title: How to transfer objects from an array of objects to another in C++?
body: <p>I have an array of objects and I want to transfer the objects to another array. I've written the code bellow to do so but it did not work. It is basically a code where 52 card objects are created in one array and distributed between two arrays.Can anyone help me?</p>
  
  <pre><code>class card
  {
  public:
      string suit;
      string value;
      void setValue(string v);
      void setSuit(string s);
  };
  void card::setValue(string v)
      {
          value=v;
      }
  void card::setSuit(string s)
      {
          suit=s;
      }
  int main()
  {
      string suites[]={"Spades","Hearts","Diamonds","Clubs"};
      string values[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
      card cards[52];
      int i=0;
          for(int j=0;j&lt;4;j++){
              for(int k=0;k&lt;13;k++){
                  cards[i].setSuit(suites[j]);
                  cards[i].setValue(values[k]);
                  i++;
              }
          }
      card player1_cards[26];
      card player2_cards[26];
      for(int a=0;a&lt;52;a++){
          if(a%2==0){
                  player1_cards[a]=cards[a];
          }
          else{
              player2_cards[a]=cards[a];
          }
      }
      return 0;
  }
  </code></pre>