-
Notifications
You must be signed in to change notification settings - Fork 0
/
die-main.cc
63 lines (55 loc) · 1.36 KB
/
die-main.cc
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
63
/*
* Author: Tim Steinberger
* Date: 12/11/19
* Description: A file
*/
#ifndef DIE_H
#define DIE_H
#include <iostream>
#include <fstream>
using namespace std;
class Die {
public:
/**
* Die constructor:
* Seed the random number generator, set the number of sides
* to 6, and assign a random value (1-numSides) to faceValue
*/
Die();
/**
* Die constructor:
* Seed the random number generator, set the number of sides
* to newNumSides, and assign a random value (1-numSides) to faceValue
*/
Die(int newNumSides);
/**
* getFaceValue
* @return the face value of the die
*/
int getFaceValue();
/**
* getNumSides
* @return the number of sides of the die
*/
int getNumSides();
/**
* setNumSides: change the number of the die sides and ignore it if invalid
* @param newNumSides
*/
void setNumSides(int newNumSides);
/**
* roll: assign a new random value to the die face
* @return the face value assigned
*/
int roll();
/**
* operator <<, overloads the insertion operator to print
* the face value of the die.
* @return the stream used
*/
friend ostream& operator <<(ostream &out, const Die &d);
private:
int faceValue; ///the face value of the die
int numSides; ///number of faces of the die
};
#endif