Cards against Humanity code.
Dec 4, 2016 at 8:59am UTC
The game has 4 rounds. I've stored cards assigned to each player in vectors. How would i create rounds in this game? Would i create a loop in the main function to run 4 times and clear the vectors and call my functions within the loop?
Here is my main function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
int main()
{
vector<string> player;
vector<string> blackCards;
vector<string> whiteCards;
vector<string> CardCzar;
vector<string> player2;
vector<string> player3;
vector<string> player4;
int sz = 0;
int i = 0;
string n;
for (i=0;i<4;i++)
{ cout<<"Enter name for player" <<" " << i+1 << " : " <<" " ;
cin>> n;
player.push_back(n);
}
BlackCards(blackCards);
WhiteCards(whiteCards);
order(player);
sz = player.size();
cout<<" " <<endl;
cout<<"*" <<player[sz - 4]<<" , " <<"you are the card czar for this round *" <<endl;
assign_bcards(blackCards , CardCzar, player);
assign_wcards(whiteCards, player2, player3, player4, player);
return 0;
}
Topic archived. No new replies allowed.