-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dice.h
62 lines (50 loc) · 1.23 KB
/
Dice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @file : Dice.h
* @author : John Gibbons
* @date : 2014.01.29
* Purpose: Header file of Dice Class. Used to emulate a dice with the number of sides given at construction time.
*/
/**
* The ifndef, define block is used to avoid redefintion and other errors that can occur
* during compilation.
* NOTE: the #endif at the end of the file.
*
* The name you choose is up to you. Convention is to use the name of your header file
* in all caps, replacing the period with an underscore.
*/
#ifndef DICE_H
#define DICE_H
#include <cstdio> /** NULL */
#include <cstdlib> /** srand(), rand() */
#include <ctime> /** time() */
class Dice
{
public:
/**
* @pre None
* @post Creates and initializes a Dice instance
* @return Initialzed Dice with 6 sides
*/
Dice();
/**
* @pre numSides is 2 or greater
* @post Creates and initializes a Dice instance
* @return Initialzed Dice with m_numSides initialzed to numSides.
*/
Dice(int numSides);
/**
* @pre None
* @post Creates and initializes a Dice instance
* @return a pseudo-random number from 1 up and including and m_numSides
*/
int roll();
/**
* @pre None
* @post None
* @return the value of m_numSides
*/
int getNumSides();
private:
int m_numSides;
};
#endif