Hi guys,

I am working on a project on playing cards using enum and class. I really need help with the function defination in this project,

Here i will attach the question, your help will be highly appreciated. You can get bac to me trough jeymineb at yahoo.co.uk.

Thanks.

If you can help, I can give you what Ii have and we can work it out. Thanks again.

Use enum and class to define a Card class. The Card class has two private variables: color and number and all necessary methods including overloaded operator >.

This is how the game is played: Your program asks if the player wants a card, if yes, your program will randomly draw a card (you need to use the random number generator function twice, once for the color and once for the number of card) and displays the player's card on screen. then your program draws a card for dealer and displays the dealer's card as well as the comparison result, such as you win or dealer wins. Use a loop so that the player can play another game if he chooses.

Note on random number generator function.

C++'s library has a rand( ) function you can call to generate a random number between 0 and maximum integer the system allows. It should be seeded with an integer value that is sent to srand(), i.e, you first call srand(seed); before calling the rand( ) function. seed is an integer of your choice. rand( ) % n returns a random number in the range between 0 and n-1 inclusive.

So to generate a card, you can use the following

int seed=234; //use any number you want;

srand(seed);

color=rand( )%4+1; //rand( )%4 generates a random number between 0 and 3, plus 1, then it is a random number between 1 and 4.

similarly you can get a card number.