Question: I need help understanding and writing Pseudocode for this C++ program... The only example I have been given is: Good ExampleFollows Steps One at a

I need help understanding and writing Pseudocode for this C++ program... The only example I have been given is:

Good ExampleFollows Steps One at a Time Through the End of the Algorithm

function doProgrammingHomework():

GET a computer

OPEN the Blackboard module

FOR each of the problems in the module

Complete problem

WHILE the problem does not compile

Debug

ENDWHILE

Submit the assignment

ENDFOR

Shut down the computer

>>**But this does not help me to understand how to write the pseudocode for my dice game:<<

#include

#include

#include

#include

using namespace std;

const int DICE = 4;

//Player Class

class Player

{

private:

string name;

int diceLeft;

int hand[DICE];

public:

//constructor

Player(string theName);

int diceCount[6];

//methods

void roll();

void show();

void count();

};

//Player constructor definition

Player::Player(string theName)

{

name = theName;

diceLeft = DICE;

}

//Player method definitions

void Player::roll()

{

for (int i = 0; i < diceLeft; ++i)

{

hand[i] = 1 + rand()%6;

}

}

void Player::show()

{

for (int i = 0; i < diceLeft; ++i)

{

cout << hand[i] << endl;

}

}

void Player::count()

{

for (int i = 0; i < 6; ++i)

{

diceCount[i] = 0;

}

for (int n = 0; n < diceLeft; ++n)

{

diceCount[hand[n]-1]++;

}

}

//MAIN FUNCTION

int main()

{

srand(time(NULL));

//Players

Player p1("Herald");

Player p2("Baloo");

//Everyone Rolls();

cout << " Rolling... ";

p1.roll();

p2.roll();

//Shows player own dice.

cout << "You rolled ";

p1.show();

cout << endl;

p2.show();

cout << endl;

p2.count();

for (int i = 0; i<6; ++i)

{

cout << p2.diceCount[i] << endl;

}

system("pause");

return 0;

}

Edit & Run

>>** This is what I have written so far and I don't even know if it is right:<<

#Get Library

Declare and wrap all Standard Template Library;

Name the integer Dice and = it to the number 4

Name the class to be accessed by the named specifiers

Open a statement

Allow access specifier private:

request the user to input words;

Allow whole numbers and call upon it by using the name diceLeft;

Initialize hand [Initialize the integer DICE];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!