I am trying to do a deck of cards in linear form so that I would be able to tell if I am guessing the right card. The program should be able to tell if the guess is getting closer or not. I made a random number generator (randomNum = rand() % 52) and the user inputs the rank and suit.
What I did with this is 2 of clubs would be the first card in the deck, Jack of Clubs would be no. 10, followed by the queen, king, and ace.
The "lowest card" would be 2C and the highest card would be the ace of spades. Is there anyway that I can make this efficient?
//Checks the user guess of suit and rank and assigns
the card number
if(guessSuit == 'C')
{
if(guessRank == 2)
{
theCard = 1;
}
else if(guessRank == 3)
{
theCard = 2;
}
else if(guessRank == 4)
{
theCard = 3;
}
else if(guessRank == 5)
{
theCard = 4;
}