Could someone help me to put enumerated data type in c++ for a poker program (specially for color and cardtype)?
I can sent the hole program to your mail. Please help.
Here are some codes:
//card.cpp
#include "cCard.h"
using namespace std;
cCard::cCard()
{
}
cCard::cCard(colors clr, int vl)
{
color = clr;
value = vl;
}
colors cCard::getColor()
{
return color;
}
int cCard::getValue()
{
return value;
}
void cCard::print()
{
string temp;
temp += getColor();
switch ( getValue() )
{
case 0: temp+= "2 "; break;
case 1: temp+= "3 "; break;
case 2: temp+= "4 "; break;
case 3: temp+= "5 "; break;
case 4: temp+= "6 "; break;
case 5: temp+= "7 "; break;
case 6: temp+= "8 "; break;
case 7: temp+= "9 "; break;
case 8: temp+= "10 "; break;
case 9: temp+= "Kn "; break;
case 10: temp+= "Q "; break;
case 11: temp+= "K "; break;
case 12: temp+= "A "; break;
}
cout << temp;
}
//cCard.h
#ifndef CCARD_H
#define CCARD_H
#include <iostream>
#include <string>
enum colors { HEARTS = 3, CLUBS, SPADES, DIAMONDS };
class cCard
{
colors color;
int value;
public:
cCard();
cCard(colors, int);
void print();
int getValue();
colors getColor();
};
#endif
and so on...