Question: Help with error in code. Line 5 5 too few arguments in function call and 'Input::GetInteger' function does not take 1 arguments #include WarGame.h
Help with error in code. Line too few arguments in function call and 'Input::GetInteger' function does not take arguments
#include "WarGame.h
#include
#include
#include
#include
#include
#include "Input.h
std::vector WarGame::cards;
WarGame::WarGamestd::string cardsFile
LoadCardscardsFile;
void WarGame::LoadCardsstd::string filePath
std::ifstream filefilePath;
if file.isopen
std::cerr "Failed to open the file." std::endl;
return;
std::string line, suits, faces;
std::getlinefile suits; Read the first line for suits
std::getlinefile faces; Read the second line for faces
std::stringstream ssSuitssuits;
std::stringstream ssFacesfaces;
std::vector suitList, faceList;
std::string suit, face;
while std::getlinessSuits suit,
suitList.pushbacksuit;
while std::getlinessFaces face,
faceList.pushbackface;
for const auto& s : suitList
for const auto& f : faceList
cards.emplacebacks f;
file.close;
void WarGame::ShowCards
for const auto& card : cards
card.Print;
std::cout std::endl;
void WarGame::shuffle
int ndx ndx;
srandunsigned inttimeNULL;
for sizet i ; i ; i
ndx rand;
ndx rand;
Card temp cardsndx;
cardsndxcardsndx;
cardsndx temp;
void WarGame::PlayGameconst std::string& playerName, std::vector& highScores, const std::string& highScoreFile
shuffle;
Player npcNPC;
Player playerplayerName;
for sizet i ; i cards.size; i
if i
player.PushCardcardsi;
else
npcPushCardcardsi;
std::vector unclaimedPile;
while playerHasCards && npcHasCards
Card playerCard player.PopCard;
Card npcCard npcPopCard;
std::cout player.GetNames card: ;
playerCard.Print;
std::cout vs NPCs card: ;
npcCard.Print;
std::cout std::endl;
unclaimedPile.pushbackplayerCard;
unclaimedPile.pushbacknpcCard;
int compResult playerCard.ComparenpcCard;
if compResult
player.WonCardsunclaimedPile;
unclaimedPile.clear;
std::cout player.GetName wins this round!" std::endl;
else if compResult
npcWonCardsunclaimedPile;
unclaimedPile.clear;
std::cout NPC wins this round!" std::endl;
else
std::cout "It's a tie!" std::endl;
std::cout
Final Scores:
;
std::cout player.GetName: player.GetScore std::endl;
std::cout NPC: npcGetScore std::endl;
if npcGetScore player.GetScore
std::cout NPC won the game!" std::endl;
else if npcGetScore player.GetScore
std::cout player.GetName won the game!" std::endl;
if playerGetScore highScores.backGetScore
HighScore newHighScoreplayerGetName player.GetScore;
auto it std::lowerboundhighScoresbegin highScores.end newHighScore,
const HighScore& lhs const HighScore& rhs
return lhsGetScore rhsGetScore;
;
highScores.insertit newHighScore;
highScores.popback;
HighScore::SaveHighScoreshighScoreFile highScores;
HighScore::ShowHighScoreshighScores;
else
std::cout "The game is a tie!" std::endl;
int playAgain Input::GetIntegerDo you want to play again? for yes, for no: ;
if playAgain
PlayGameplayerName highScores, highScoreFile;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
