Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-W-Ward authored Jun 15, 2021
1 parent b6df048 commit f4c7007
Show file tree
Hide file tree
Showing 10 changed files with 1,041 additions and 0 deletions.
1 change: 1 addition & 0 deletions Card.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "Card.h"
81 changes: 81 additions & 0 deletions Card.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#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

};

Loading

0 comments on commit f4c7007

Please sign in to comment.