Question: The following program simulates shuffling of cards. While it does the job, it is not very object-oriented. There are no Card objects! Fix that by
The following program simulates shuffling of cards. While it does the job, it is not very object-oriented. There are no Card objects! Fix that by defining a Card class and using a vector of Card objects instead of vector
Complete the following file: (Use the code below) (Will post images as reference and code to copy and paste into compiler) (Areas in the code that are grey cannot be changed, only the white areas) Thank you!

Down below is the same code as the images if you need to copy and paste onto compiler.
Cards.cpp
#include
using namespace std;
// Define a class Card
class Card { public: Card(string v, string s); // ... private: // ... }; // ...
int main() { srand(42); // Change this code to use a vector of Card objects
vector
// Change this code to add Card objects to the vector
values.push_back("Ace"); suits.push_back("Spades"); values.push_back("9"); suits.push_back("Hearts"); values.push_back("Queen"); suits.push_back("Diamonds"); values.push_back("6"); suits.push_back("Clubs");
const int CARDS = 4; const int SHUFFLES = 10; for (int i = 0; i
string temp = values[from]; values[from] = values[to]; values[to] = temp;
temp = suits[from]; suits[from] = suits[to]; suits[to] = temp;
}
for (int i = 0; i
cout
}
return 0; }
Complete the following file: Cards.cpp #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
