Question: need help #include cards.h #include cards.cpp #include #include #include using namespace std; bool play_again(); int main() { srand(time(0)); do { // Create a deck and

need help

#include "cards.h" #include "cards.cpp" #include #include #include using namespace std;

bool play_again();

int main() { srand(time(0));

do { // Create a deck and shuffle it Deck deck; Deck.shuffle();

// Deal three cards to each player ThreeCardHand player1, player2; for (int i = 0; i < 3; i++) { player1.insert(deck.deal()); player2.insert(deck.deal()); }

// Display the hands std::cout << "Player 1: " << player1.str() << std::endl; std::cout << "Player 2: " << player2.str() << std::endl;

// Determine which player wins if (false) // true if player 1 wins cout << "Player 1: wins. "; else if (false) // true if player 2 wins cout << "Player 2: wins. "; else cout << "Game is a tie. ";

} while (play_again()); } bool play_again() { char yn; // yes/no response cout << " Play again? (y/n): "; cin >> yn; cin.ignore(INT_MAX, ' '); // flush any extra characters yn = tolower(yn); while (yn != 'y' && yn != 'n') { cout << "Please enter y or n: "; cin >> yn; cin.ignore(INT_MAX, ' '); yn = tolower(yn); } cout << endl; return yn == 'y'; } ./main.cpp:19:9: error: cannot use dot operator on a type Deck.shuffle(); ^ ./main.cpp:22:6: error: unknown type name 'ThreeCardHand' ThreeCardHand player1, player2; ^ ./main.cpp:26:9: error: use of undeclared identifier 'player2'; did you mean 'player1'? player2.insert(deck.deal()); ^~~~~~~ player1 ./main.cpp:22:20: note: 'player1' declared here ThreeCardHand player1, player2; ^ ./main.cpp:31:34: error: use of undeclared identifier 'player2' std::cout << "Player 2: " << player2.str() << std::endl; ^ 4 errors generated. make: *** [Makefile:10: main] Error 1 exit status 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!