-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.h
81 lines (76 loc) · 1.41 KB
/
Card.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include<string>
#include<sstream>
struct Card
{
enum color
{
Red = 1, Green = 2, Purple = 3
};
enum shading
{
Filled = 1, Open = 2, Striped = 3
};
enum shape
{
Diamond = 1, Oval = 2, Squiggle = 3
};
std::stringstream CardStream;
std::string Attributes;
int NumOfSymbols{ 0 };
char colorChar, shadingChar, shapeChar{};
int colorInt, shadingInt, shapeInt{0};
#pragma region Constructors/Destructors
Card() :Attributes(""), NumOfSymbols(), colorChar(), shadingChar(), shapeChar(),colorInt(),shadingInt(),shapeInt(){}
Card(std::string In) :Attributes(In),colorInt(0),shadingInt(0),shapeInt(0)
{
CardStream << Attributes;
CardStream >> NumOfSymbols;
CardStream >> colorChar;
switch(colorChar)
{
case 'R':
colorInt = Red;
break;
case 'G':
colorInt = Green;
break;
case 'P':
colorInt = Purple;
break;
default:
break;
}
CardStream >> shadingChar;
switch(shadingChar)
{
case'F':
shadingInt = Filled;
break;
case 'O':
shadingInt = Open;
break;
case'S':
shadingInt = Striped;
default:
break;
}
CardStream >> shapeChar;
switch(shapeChar)
{
case 'D':
shapeInt = 1;
break;
case'O':
shapeInt = 2;
break;
case'S':
shapeInt = 3;
break;
default:
break;
}
}
//Card(int Num, int color, int shading, int shape) :NumOfSymbols(Num), colorStr(color),shadingStr(shading),shapeChar(shape){}
#pragma endregion
};