Question: I need help writing a program in C + + using File I / O , delimeters, card.csv and etcthe code ive provided.I need help

I need help writing a program in C++ using File I/O, delimeters, card.csv and etcthe code ive provided.I need help with the following:
Loading Cards
Add a static LoadCards method to the WarGame class.Declare your method in the WarGame.h file and define the method in the WarGame.cpp file.
It should have a string parameter for the file path.In the method, it should read the cards.csv file and split the data to get the suits and faces.
Use them to create
52 unique cards and store each card in the cards vector field of the class.
NAME RETURNS PARAMETERS
LoadCards nothing string
Call the LoadCards method from the WarGame constructor.
Part A 2
Showing Cards
Add a static ShowCards method to the WarGame class.Declare your method in the WarGame.h file and define the method in the WarGame.cpp file.
Loop over the vector and call the Print method on each card.Make sure each card appears on a new line.
NAME RETURNS PARAMETERS
ShowCards nothing none
In case 1 of the menu, call the ShowCards method from main(which is in the CardWars.cpp file).
Part A 3
HighScore class
Add a HighScore class with a name field and a score field both with getter
/setter methods.
Add a constructor that takes a name and score.
Part A 4
Player class
Add a Player class with a name field, a score field, a pile field which is a vector of cards, and a won field which is a vector of cards.Add getter/setter methods for the score and name fields.
Add the following methods : HasCards, PushCard, PopCard, and WonCards.
HasCards will return true if there are cards in the pile vector.
PushCard will take a card parameter and add it to the pile vector of cards.
PopCard will remove a card from the pile vector of cards and return the card.
WonCards will take a vector of cards and add it to the won vector of cards and update the score field.
cards.csv:
Hearts?Diamonds?Clubs?Spades
A?2?3?4?5?6?7?8?9?10?J?Q?K
main file
CardWars.cpp
#include
#include "Console.h"
#include "Input.h"
#include "WarGame.h"
#include "Tester.h"
int main()
{
Tester cardWarsTest;
Console::ResizeWindow(150,30);
int menuSelection =0;
std::vector menuOptions{"1. Show Cards", "2. Show High Scores", "3. Play Card Wars", "4. Exit" };
std::string highScoreFile = "HighScores.csv";
std::string cardsFile = "cards.csv";
WarGame war(cardsFile);
do
{
Console::Clear();
menuSelection = Input::GetMenuSelection(menuOptions);
Console::Clear();
switch (menuSelection)
{
case 1:
{
/*
After creating the ShowCards method to the WarGame class, call the method here.
*/
break;
}
case 2:
{
/*
After creating the ShowHighScores method to the HighScore class, call the method here passing the highScores vector.
*/
break;
}
case 3:
{
/*
After creating the PlayGame method to the WarGame class, call the method here passing the highScoreFile string and the highScores vector.
*/
break;
}
default:
break;
}
Input::PressEnter();
} while (menuSelection != menuOptions.size());
}
WarGame.h:
#pragma once
#include
#include
#include "Card.h"
class WarGame
{
public:
WarGame(std::string cardsFile);
private:
static std::vector _cards;
static void shuffle();
};
WarGame.cpp
#include "WarGame.h"
#include
#include
#include
#include
#include
#include "Input.h"
#include "Card.h"
std::vector WarGame::_cards;
void WarGame::shuffle()
{
int ndx1, ndx2;
srand((unsigned int)time(NULL));
for (size_t i =0; i 52; i++)
{
ndx1= rand()%52;
ndx2= rand()%52;
Card temp =_cards[ndx1];
_cards[ndx1]=_cards[ndx2];
_cards[ndx2]= temp;
}
}
Card.h:
#pragma once
#include
using namespace std;
#if defined(_WIN32)|| defined(__MSDOS__)
#define SPADE '\x06'
#define CLUB '\x05'
#define HEART '\x03'
#define DIAMOND '\x04'
#else
#define SPADE '\u2660'
#define CLUB '\u2663'
#define HEART '\u2665'
#define DIAMOND '\u2666'
#endif
//enum Suit
//{
// Hearts=1,
// Diamonds,
// Clubs,
// Spades
//};
//enum Face
//{
// Ace =1, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King
//};
class Card
{
public:
Card(std::string suit, std::string face)
{
_suit = suit;
_face = face;
}
std::string GetSuit() const { return _suit; }
void SetSuit(std::string suit){_suit = suit; }
std::string GetFace() const { return _face; }
void SetFace(std::string face){_face = face; }
I need help writing a program in C + + using File

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 Programming Questions!