main.cpp - Code:Blocks 20.03 File Edit View Search Project Build Debug Fortran wxSmith Tools Tools+ Plugins DoxyBlocks Settings Help main) : int ** OOO Q Q S C Management Start here X card.cpp x card.h x deck.cpp x deck.h x hand.cpp x hand.h x main.cpp x Projects Files FSymbols D O Workspace 43 getline (cin, exchangeCards); 44 45 while (exchangeCards != "y" && exchangeCards != "y" && exchangeCards != "x" &s exchangeCards != "n") 46 47 cout <« "Please enter Y or N only: "; 48 getline (cin, exchangeCards); 49 50 51 52 if (exchangeCards = "y" || exchangeCards = "y") 53 54 myHand.exchangeCards (myDeck) ; 55 56 cout << endl; 57 58 myHand.print (); 59 60 cout << endl; 61 Logs & others 1 P Code:Blocks X Search results X P Cccc X OBuild log x Build messages x CppCheck/Vera++ X CppCheck/Vera++ messages X 2 Cscope X O Debugg File Line Message === Build file: "no target" in "no project" (compiler: unknown) === In function 'int main()': error: no match for 'operator||' (operand types are 'const char [2]' and 'std::_cxxll... C:\Users\Mica... C:\Users\Mica... 52 C:\Users\Mica... 52 note: candidate: 'operator|| (bool, bool)' C:\Users\Mica... 52 note: no known conversion for argument 2 from 'std::_exxll::string' (aka 'std:: CAUsers\Micai\Downloads\AssignmentZ\main.cpp C/C++ Windows (CR+LF) WINDOWS-1252 Line 52, Col 1, Pos 1323 Insert Read/Write default
I am trying to compile a poker game:
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <sstream>
#include "card.h"
#include "deck.h"
#include "hand.h"
using namespace std;
/************************************************************
* FunctionName *
* Function description *
* *
* *
************************************************************/
int main()
{
string repeat = "Y";
Deck myDeck;
Hand myHand;
string exchangeCards;
while (repeat == "Y" || repeat == "y")
{
cout << endl;
myHand.newHand(myDeck);
myHand.print();
cout << endl;
cout << "Would you like to exchange any cards? [Y / N]: ";
getline(cin, exchangeCards);
while (exchangeCards != "Y" && exchangeCards != "y" && exchangeCards != "X" && exchangeCards != "n")
{
cout << "Please enter Y or N only: ";
getline(cin, exchangeCards);
}
if(exchangeCards = "Y" || exchangeCards = "y")
{
myHand.exchangeCards(myDeck);
}
cout << endl;
myHand.print();
cout << endl;
myDeck.reset(); // Resets the deck for a new game
cout << "Play again? [Y / N]: ";
getline(cin, repeat);
while (repeat != "Y" && repeat != "y" && repeat != "N" && repeat != "n")
{
cout << "Please enter Y or N only: ";
getline(cin, repeat);
}
}
return 0;
}
deck.h:
deck.h
#ifndef DECK_H
#define DECK_H
#include <vector>
#include <cstdlib> // srand(), rand()
#include <ctime> // time()
#include "card.h" // Include card header file here
using namespace std;
class Deck
{
public:
// class Constructor
Deck();
// Reset deck to new state (completely undealt)
void resetDeck();
// Print all cards in the undealt deck
void printUndealtDeck();
// Print all cards in the dealt deck
void printDealtDeck();
// Get size of the undealt deck
const int getSizeUndealtDeck();
// Get size of the dealt deck
const int getSizeDealtDeck();
// Deal a single card
Card dealCard(); // Is the dealCard() here an accessor or mutator function???
private:
vector<Card> m_undealtDeck; // Undealt cards
vector<Card> m_dealtDeck; // Dealt cards
};
#endif
// card.h
#ifndef CARD_H
#define CARD_H
#include <iostream>
#include <string>
using namespace std;
// Sources: https://en.wikipedia.org/wiki/Standard_52-card_deck
// https://en.wikipedia.org/wiki/Pip_(counting)
const string pips[] = {"Ace", "Two", "Three", "Four", "Five",
"Six", "Seven", "Eight", "Nine", "Ten",
"Jack", "Queen", "King"};
const string suits[] = {"Hearts", "Spades", "Clubs", "Diamonds"};
class Card
{
public:
// Get card value
int get();
// Set card value
void set(int value);
string getPip();
string getSuit();
// Print card value
void print();
private:
int m_cardValue;
};
#endif
hand.h:
hand.h
#ifndef HAND_H
#define HAND_H
#include <iostream>
#include "card.h" // Include card header file here
#include "deck.h" // Include deck header file here
using namespace std;
const int NUM_CARDS_ON_HAND = 5;
class Hand
{
public:
// Put new card from deck into given location in a hand
void newCard(Deck& deck, int location);
// Get all new cards
void newHand(Deck& deck);
// Determine cards to exchange and exchange them in a hand
void exchangeCards(Deck& deck);
// Print the hand
void print();
private:
Card m_hand[NUM_CARDS_ON_HAND]; // A hand consists of 5 cards
};
#endif
![A main.cpp - Code:Blocks 20.03
File Edit View Search Project Build Debug Fortran
wx Smith
Tools Tools+ Plugins DoxyBlocks Settings Help
| <global>
v main0 : int
+ + 2 4 Aa *
Q
Q S C
/** *<
Management
Start here X card.cpp x card.h x deck.cpp x deck.h x hand.cpp x hand.h x main.cpp x
•
Projects Files
FSymbols
getline (cin, exchangeCards);
43
Workspace
44
45
while (exchangeCards != "Y" && exchangeCards != "y" && exchangeCards != "X" && exchangeCards != "n")
46
{
47
cout << "Please enter Y or N only: ";
48
getline (cin, exchangeCards);
49
50
}
51
52
if (exchangeCards = "Y" || exchangeCards = "y")
53
{
54
myHand.exchangeCards (myDeck) ;
55
56
cout << endl;
57
58
myHand.print ();
59
60
cout << endl;
61
Logs & others
A Code:Blocks X
Search results x Cccc >x
Build log X
Build messages X CppCheck/Vera++ X CppCheck/Vera++ messages X Cscope X
ODebugg
File
Line
Message
=== Build file: "no target" in "no project" (compiler: unknown)
===
C:\Users\Mica...
In function 'int main ()':
C:\Users\Mica...
52
error: no match for 'operator||' (operand types are 'const char [2]' and 'std::_cxxll...
C:\Users\Mica...
52
note: candidate: 'operator|| (bool, bool)' <built-in>
C:\Users\Mica...
52
note:
no known conversion for argument 2 from 'std::_cxxll::string' {aka 'std::
'std::_cx...
C:\Users\Micai\Downloads\Assignment2\main.cpp
C/C++
Windows (CR+LF) WINDOWS-1252 Line 52, Col 1, Pos 1323
Insert
Read/Write
default](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe6b9d87e-6e1d-4edc-b4b6-dbb55c2a248d%2F0e316377-95d4-45cb-80cc-2fc1330a2f67%2Fduzny6n_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)