-
How would I do this?
Hello,
How would I take the below fuction and make it so you get two cards to start with and then It gives you the option to draw another?
Thank You For Your Help,
Matt
int DealUser(){
int NumCards;
cout <<"How Many Cards Do You Want? ";
NumCards=2;
cout <<"You: ";
int CardCount, Card, SumCards = 0;
do{
Card = DealCard();
cout<<Card<<" ";
SumCards+=Card;
cout <<"="<<SumCards<<endl;
char dealcardanswer;
cout <<"Another Card? (y,n)";
cin >> dealcardanswer;
}while (dealcardanswer != 'n');
return(SumCards);
}
-
I'd write the actual code for you. but I'm a little short on time. Give them two cards, input their option, if yes, draw, if not, just move on. Hope this helps.
-
int DealUser(){
int NumCards;
cout <<"How Many Cards Do You Want? ";
NumCards=2;
cout <<"You: ";
int CardCount, Card, SumCards = 0;
do{
Card = DealCard();
cout<<Card<<" ";
SumCards+=Card;
//here is where you will deal another
Card = DealCard();
cout<<Card<<" ";
SumCards+=Card;
cout <<"="<<SumCards<<endl;
char dealcardanswer;
cout <<"Another Card? (y,n)";
cin >> dealcardanswer;
}while (dealcardanswer != 'n');
return(SumCards);
}
-
two comments:
1. why are u asking how many cards the user wants in a text output when they cannot affect how many cards are drawn.
2. make sure u check that the drawn card has not already been put on the table.
Popular pages
Recent additions