Skip to content

Instantly share code, notes, and snippets.

@olund
Created February 4, 2014 21:37
Show Gist options
  • Save olund/8812846 to your computer and use it in GitHub Desktop.
Save olund/8812846 to your computer and use it in GitHub Desktop.
int main()
{
locale swedish("swedish");
locale::global(swedish);
srand((unsigned)time(NULL));
string playerName;
int nrOfCardDecks = 1;
int cardSum = 0;
int cardPos = 0;
Card lastCard;
Card cardDeck[SIZE];
makeCardDeck(cardDeck);
shuffleCardDeck(cardDeck);
CircularList<Player> players;
addPlayers(players);
cout<<endl;
cardPos = dealCards(cardDeck, players);
while (players.size() > 1)
{
cout<<"New round"<<endl;
cardSum = 0;
while (handleCurrentPlayer(cardDeck, cardPos, players, cardSum));
cout<<players.currentItem().getName()<<" Lost this round"<<endl;
players.remove(players.currentItem());
// ny giv
shuffleCardDeck(cardDeck);
cardPos = dealCards(cardDeck, players);
}
cout<<"Winner : "<<players.currentItem().getName()<<endl;
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment