Andy - 'AND' combinations of size, shape, and color. Possible sizes are large and small. Possible shapes are circle, diamond, square, and triangle. Possible colors are blue, green, red, and yellow. The combination has to be from different categories so: large 'AND' blue is valid, while circle 'AND' diamond is not. It comes up to 96 or so different combinations. Its not a lot, but I'm interested in how it would be done in case I end up with an additional attribute tacked on.
edit: Also includes not attributes so nBlue, nRed, nGreen, nYellow and likewise for shapes.
Disch - Thanks for that! I'm not very fluent with the stl, but I'll give it a shot. I'll post up once I finish the class structure. I'm looking for something that goes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
string colorArray[4] = {blue, green, red, yellow, nBlue, nGreen, nRed, nYellow};
string shapeArray[4] = {circle, diamond, square, triangle, nCircle, nDiamond, nSquare, nTriangle};
string sizeArray[2] = {small, large}
for (int i = 0 ; i < sizeArray.length(); i++)
{
for (int j = 0; j < shapeArray.length(); j++)
{
hypothesis* /* I want it to name based on sizeArray[i] and shapeArray[j]*/
}
for (int k = 0; k < colorArray.length(); j++)
{
hypothesis* /* named by size array and color array*/
}
}
for (int q = 0; q < colorArray.length(); q++)
{
for(int p = 0; p < shapeArray.length; p++)
{
hypothesis* /* named for color and shape*/
}
}
|
actually, thinking about it now. Its not very important that they have names. I think I'm just gonna shove them in an array and be done with it.