1 Using the notation of Cartesian products, mappings, and disjoint unions, write down (a) the set of values of each of the following C++ types:
enumSuit {club, diamond, heart, spade};
structCard {Suit s;byter;};
typedefCard[] Hand;structTurn {boolpass; Card play; }; and (b) the set of values of each of the following ADA types:
typeSuitis(club, diamond, heart, spade);
typeRankis range2 .. 14;
typeCardis
record
s: Suit;
r: Rank;
end record;
typeHandis array(1 .. 7)ofCard;
typeTurn (pass: Boolean)is
casepassis
whenfalse => play: Card;
whentrue =>null;
end case;
What is the cardinality of each type?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here