This commit is contained in:
Alexander Zhirov 2021-06-26 00:19:33 +03:00
parent aeddf4cc21
commit 2d9dea4a3c
2 changed files with 38 additions and 8 deletions

View File

@ -1,8 +1,44 @@
#ifndef EXERCISE_4_HPP_
#define EXERCISE_4_HPP_
#include <iostream>
class Card
{
public:
enum rank {ACE = 1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING};
enum suit {CLUBS, DIAMONDS, HEARTS, SPADES};
Card(rank r = ACE, suit s = SPADES, bool ifu = true): m_Rank(r), m_Suit(s), m_IsFaceUp(ifu) { }
int GetValue() const;
void Flip();
// friend std::ostream& operator<<(std::ostream& s, const Card& aCard);
private:
rank m_Rank;
suit m_Suit;
bool m_IsFaceUp;
};
int Card::GetValue() const
{
int value = 0;
if (m_IsFaceUp)
{
value = m_Rank;
if (value > 10)
{
value = 10;
}
}
return value;
}
void Card::Flip()
{
m_IsFaceUp = !m_IsFaceUp;
}
#endif

View File

@ -15,10 +15,9 @@ void ex_4();
int main()
{
// ex_1();
// ex_2();
ex_1();
ex_2();
ex_3();
ex_4();
return 0;
}
@ -129,8 +128,3 @@ void ex_3()
* [c >= a] 0 >= 3/9 is false
*/
}
void ex_4()
{
}