Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>to add to John's answer:</p> <p>what you want to pass to the <code>shuffle</code> function is a deck of cards from the class <code>deckOfCards</code> that you've declared in main; however, the deck of cards or <code>vector&lt;Card&gt; deck</code> that you've declared in your class is private, so not accessible from outside the class. this means you'd want a getter function, something like this:</p> <pre><code>class deckOfCards { private: vector&lt;Card&gt; deck; public: deckOfCards(); static int count; static int next; void shuffle(vector&lt;Card&gt;&amp; deck); Card dealCard(); bool moreCards(); vector&lt;Card&gt;&amp; getDeck() { //GETTER return deck; } }; </code></pre> <p>this will in turn allow you to call your shuffle function from main like this:</p> <pre><code>deckOfCards cardDeck; // create DeckOfCards object cardDeck.shuffle(cardDeck.getDeck()); // shuffle the cards in the deck </code></pre> <p>however, you have more problems, specifically when calling <code>cout</code>. first, you're calling the <code>dealCard</code> function wrongly; as <code>dealCard</code> is a memeber function of a class, you should be calling it like this <code>cardDeck.dealCard();</code> instead of this <code>dealCard(cardDeck);</code>.</p> <p>now, we come to your second problem - print to standard output. you're trying to print your deal card, which is an object of type <code>Card</code> by using the following instruction:</p> <pre><code>cout &lt;&lt; cardDeck.dealCard();// deal the cards in the deck </code></pre> <p>yet, the <code>cout</code> doesn't know how to print it, as it's not a standard type. this means you should <a href="http://en.cppreference.com/w/cpp/language/operators" rel="nofollow">overload</a> your <code>&lt;&lt;</code> operator to print whatever you want it to print when calling with a <code>Card</code> type.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload