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: enum Suit {club, diamond, heart, spade}; struct Card...


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:



enum
Suit {club, diamond, heart, spade};



struct
Card {Suit s;
byte
r;};



typedef
Card[] Hand;
struct
Turn {
bool
pass; Card play; }; and (b) the set of values of each of the following ADA types:



type
Suit
is
(club, diamond, heart, spade);



type
Rank
is range
2 .. 14;



type
Card
is



record


s: Suit;


r: Rank;



end record;



type
Hand
is array
(1 .. 7)
of
Card;



type
Turn (pass: Boolean)
is



record



case
pass
is



when
false => play: Card;



when
true =>
null;



end case;



end record;


What is the cardinality of each type?



Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here