Please help! i am making a deck class that has to be able to print the current deck, draw a card, and shuffle the deck. I really need help with the shuffling portion. Here is my code so far:
}
void Deck::drawcard()
{
int i=0;
int valid=0;
while (valid==0)
{
if (totalcards[i].returntovalue()==true)
{
hand[0]=totalcards[i];
valid=1;
totalcards[i].usedcard();
}
i++;
}
valid=0;
hand[0].createcards();
}
void Deck::makefalse()
{
}
void Deck::returncard()
{
}
int main()
{
int number;
Deck myDeck;
myDeck.createdeck();
cout << "Enter a command:" << endl;
cout << "1 to show current deck" << endl;
cout << "2 to shuffle" << endl;
cout << "3 to draw a card" << endl;
cout << "4 to end program" << endl;
while (number!=4)
{
cin >> number;
if (number==1)
{
myDeck.printcurrentdeck();
}
if (number==2)
{
myDeck.shuffle();
}
if (number==3)
{
myDeck.drawcard();
}
if (number==4)
{
break;
}
}
}
Ok... If SOOO much depends on this code, why don't you put some effort into. Hell, put some effort into asking for help too! What do you want the program to do? What does it actually do? What part of the code do you think is the problem? Use [code]code here[/code] tags too, for readability.