Computers and Technology

C++ Please do not solve if you do not understand.
I have included Die. h and Die. cpp
Complete each section:
Header comments
HEADER FILES (include toolkit, Die. h, and any other header files needed)
ABSTRACT DATA TYPES (none required)
GLOBAL CONSTANTS (none required)
PROTOTYPES (none required)
MAIN PROGRAM
Display hello message
Create a pointer to a dynamically allocated Die object with 8 sides
Display number of sides and the rolled value for the die
Release memory for Die object and set pointer to nullptr
Display goodbye message
DEFINITIONS (none required)

//Die. h
#ifndef DIE_H
#include
using namespace std;
//Die class
class Die
{
private:
int sides;
public:
Die();
Die(int s);
void setSides(int s);
int getSides();
int roll();
~Die();
};
#endif DIE_H

//Die class implementation file
//Die. cpp
#include
#include
#include
#include "Die. h"
using namespace std;
//Default constructor
Die::Die()
{
srand(time(0));
sides=0;
}
//Parameter constructor
Die::Die(int s)
{
srand(time(0));
sides=s;
}
//Function setSides
void Die::setSides(int s)
{
sides=s;
}
//Function getSides
int Die::getSides()
{
return sides;
}
//roll function
int Die::roll()
{
if(sides<=0)
return 0;
return rand()%sides+1;
}
//Destructor
Die::~Die()
{
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, bombbomb2157
Eva has many contacts on the professional networking site she uses which contacts are considered second degree
Answers: 3
image
Computers and Technology, 22.06.2019 17:50, ImBADatmath8743
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
image
Computers and Technology, 23.06.2019 22:30, delawdermia27
The output voltage of a power supply is assumed to be normally distributed. sixteen observations are taken at random on voltage are as follows: 10.35, 9.30, 10.00, 9.96, 11.65, 12.00, 11.25, 9.58, 11.54, 9.95, 10.28, 8.37, 10.44, 9.25, 9.38, and 10.85
Answers: 1
Do you know the correct answer?
C++ Please do not solve if you do not understand.
I have included Die. h and Die. cpp
C...

Questions in other subjects:

Konu
Mathematics, 26.01.2021 01:00
Konu
Mathematics, 26.01.2021 01:00