#include #include #include #include #include #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; }
I already know how to program. I go passed a
exchangeCards == "Y".
#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;
}
myDeck.reset is where it won't compile. You answered my question right before, I apollogize but I thought you needed code that you didn't need. Now I can provide you with the additional code if you reject the question but in order for me to understand this next step, I need to see it. I can only understand c++ when working with others on it at the same time.
![A main.cpp - Code:Blocks 20.03
X
File Edit View Search Project Build Debug Fortran wxSmith
Tools Tools+ Plugins DoxyBlocks Settings Help
/** *<
S C
| <global>
vmain) : int
Management
Start here X main.cpp x deck.cpp X
Projects
FSymbols
Files
string repeat = "Y";
Deck myDeck;
29
Workspace
30
31
Hand myHand;
32
string exchangeCards;
33
34
while (repeat == "Y" || repeat == "y")
35
36
cout << endl;
37
38
myHand.newHand (myDeck) ;
myHand.print ();
cout << endl;
39
40
41
42
cout << "Would you like to exchange any cards? [Y / N]: ";
43
getline (cin, exchangeCards);
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 ();
cout << endl;
61
62 O
myDeck.reset () ;
// Resets the deck for a new game
63
cout << "Play again? [Y / N]: ";
getline (cin, repeat);
64
65
Logs & others
2 Code:Blocks x
Q Search results X
A Cccc X
Ở Build log X
P Build messages x CppCheck/Vera++ X 2 CppCheck/Vera++ messages X Cscope X
Z DoxyBlocks X
F Fortran info x
Closed files list X
Q Thread search x
File
Line
Message
=== Build file: "no target" in "no project" (compiler: unknown)
===
C:\Users\cccc...
In function 'int main ()':
C:\Users\ccee...
62
error: 'class Deck' has no member named 'reset'; did you mean 'resetDeck'?
=== Build failed: 1 error (s), 0 warning (s) (0 minute (s), 0 second (s)) ===
C:\Users\cccccc\Documents\Assignment 2\main.cpp
C/C++
Windows (CR+LF)
WINDOWS-1252 Line 59, Col 1, Pos 1497
Insert
Read/Write default](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe6b9d87e-6e1d-4edc-b4b6-dbb55c2a248d%2Fe3598d53-33d6-4dc2-8dc5-4753e193bfdd%2F7h42jow_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









