diff options
Diffstat (limited to 'src/main/Card.cpp')
| -rw-r--r-- | src/main/Card.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/Card.cpp b/src/main/Card.cpp new file mode 100644 index 0000000..ead2fd5 --- /dev/null +++ b/src/main/Card.cpp @@ -0,0 +1,25 @@ +// +// Created by thecharlesblake on 10/11/17. +// + +#include "Card.h" +#include <string> + +Card::Card(const int r, const std::string s): rank(r), suit(s) {} + +std::ostream & operator<<(std::ostream & Str, Card const & c) { + std::string r; + if (c.rank == 1) { + r = "A"; + } else if (c.rank <= 10) { + r = std::to_string(c.rank); + } else if (c.rank == 11) { + r = "J"; + } else if (c.rank == 12) { + r = "Q"; + } else if (c.rank == 13) { + r = "K"; + } + + return Str << r << c.suit; +}
\ No newline at end of file |
