Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ [Error] no matching function for call to
    primarykey
    data
    text
    <p>I can't compile my code because of some errors. </p> <p>Here some of them :</p> <p>In function 'int main(int, char**)':</p> <pre><code>[Error] no matching function for call to 'deckOfCards::shuffle(deckOfCards&amp;)' [Note] candidate is: In file included from main.cpp [Note] void deckOfCards::shuffle(std::vector&lt;Card&gt;&amp;) [Note] no known conversion for argument 1 from 'deckOfCards' to 'std::vector&lt;Card&gt;&amp;' [Error] 'dealCard' was not declared in this scope </code></pre> <hr> <pre><code>#include &lt;iostream&gt; using namespace std; class Card { private: int m_suit; int m_face; public: Card(int face, int suit); static string suits[]; static string faces[]; string toString(string s_face, string s_suit); int getFace(); void setFace(int face); int getSuit(); void setSuit(int suit); }; Card::Card(int face, int suit) { m_face = face; m_suit = suit; } string Card::suits[] = {"Hearts", "Diamonds", "Clubs", "Spades"}; string Card::faces[] = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; int Card::getFace(){return m_face;} void Card::setFace(int face){m_face = face;} int Card::getSuit(){return m_suit;} void Card::setSuit(int suit){m_suit = suit;} string Card::toString(string s_face, string s_suit) { string card = s_face + " of " + s_suit; return card; } #include &lt;iostream&gt; // cout #include &lt;algorithm&gt; // random_shuffle #include &lt;vector&gt; // vector #include &lt;ctime&gt; // time #include &lt;cstdlib&gt; #include "Card.h" using namespace std; 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(); }; int deckOfCards::count = 0; int deckOfCards::next = 0; deckOfCards::deckOfCards() { const int FACES = 12; const int SUITS = 4; int currentCard = 0; for (int face = 0; face &lt; FACES; face++) { for (int suit = 0; suit &lt; SUITS; suit++) { Card card = Card(face,suit); //card created and initialized deck.push_back(card); currentCard++; } } } void deckOfCards::shuffle(vector&lt;Card&gt;&amp; deck) { random_shuffle(deck.begin(), deck.end()); /*vector&lt;Card&gt;::iterator iter; for (iter = deck.begin(); iter!=deck.end(); iter++) { Card currentCard = *iter; random_shuffle(deck.begin(), deck.end()); Card randomCard = deck[num]; //change values..... }*/ } Card deckOfCards::dealCard() { Card nextCard = deck[next]; next++; return nextCard; } bool deckOfCards::moreCards() { if (count &lt; 52) { count++; return true; } else return false; } #include &lt;iostream&gt; #include "deckOfCards.h" using namespace std; int main(int argc, char** argv) { deckOfCards cardDeck; // create DeckOfCards object cardDeck.shuffle(cardDeck); // shuffle the cards in the deck while (cardDeck.moreCards() == true) { cout &lt;&lt; dealCard(cardDeck);// deal the cards in the deck } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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