coin Class Reference
A simple coin object.
More...
#include <coin.h>
List of all members.
Public Member Functions |
| coin () |
| Constructor seeds random number generator.
|
void | flip () |
| Flip coin and returns true if heads else false if tails.
|
void | flip (int aN) |
| Flip a coin "aN" times.
|
void | display () |
| Display the state of the coin.
|
Detailed Description
A simple coin object.
Coin is a class object which impliments the tossing of a coin to determine heads or tails.
This coin object uses a random number to determine heads or tails. Single coin flips or multiple flips are implimented.
Definition at line 25 of file coin.h.
Constructor & Destructor Documentation
Constructor seeds random number generator.
Definition at line 28 of file coin.h.
Member Function Documentation
Display the state of the coin.
Write "Heads" or "Tails" to cout stream
Definition at line 49 of file coin.cc.
Referenced by flip().
void coin::flip |
( |
int |
aN |
) |
|
Flip a coin "aN" times.
This method call the member function flip() multiple times to flip a coin "aN" times. Results are summarized.
Definition at line 32 of file coin.cc.
References flip().
Flip coin and returns true if heads else false if tails.
Uses random number generator, drand48() to determine heads or tails. Note, drand48() should be seeded via srand48() in the default constructor.
Definition at line 19 of file coin.cc.
References display().
Referenced by flip(), and main().
The documentation for this class was generated from the following files: