C++
Please do not solve if you do not understand.
I have included Die. h and Die. cpp
C...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 06.08.2021 18:10 kcarstensen59070
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()
{
}
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 15:50
Subscribe to j p g a m e t u b e on you tube ?
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 21:40
is on drugs i swear i ask a question and its not showing whats going
Answers: 2
You know the right answer?
Questions
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 27.01.2021 20:10
![question](/tpl/images/cats/mat.png)
Mathematics, 27.01.2021 20:10
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 27.01.2021 20:10
![question](/tpl/images/cats/mat.png)
Mathematics, 27.01.2021 20:10
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 27.01.2021 20:10
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/en.png)
English, 27.01.2021 20:10
![question](/tpl/images/cats/pravo.png)
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 27.01.2021 20:10
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/biologiya.png)