60 lines
1.1 KiB
C++
Raw Normal View History

2025-02-20 19:01:27 +00:00
#pragma once
#include <string>
#include <iostream>
class Card
{
public:
std::string key;
std::string kind;
std::string value;
int number = 0;
double worth = 0;
Card()
{
// NULL
}
Card(const Card &card)
{
this->key = card.key;
this->kind = card.kind;
this->value = card.value;
this->number = card.number;
this->worth = card.worth;
}
Card(std::string key)
{
this->key = key;
this->kind = key.substr(0, 1);
this->value = key.substr(1, key.length() - 1);
this->number = valueToNumber(this->value);
this->worth = this->number * 0.01;
}
int valueToNumber(std::string alue)
{
if (value == "K")
{
return 13;
}
else if (value == "Q")
{
return 12;
}
else if (value == "J")
{
return 11;
}
else if (value == "A")
{
return 14;
}
else
{
return stoi(value);
}
}
};