Question
Data Structure and algorithm write program in C++ You got an internship in a game developing company. They gave you first task of developing a
Data Structure and algorithm
write program in C++
You got an internship in a game developing company. They gave you first task of developing a mini dice rolling game using data structures and C++ as programming language. Your game should meet the following requirements.
Requirements:
1. Game should be built with the help of stack, link list, array and queue data structures. 2. Game will prompt user to enter the number of players in game.
3. Input the name of player and take 5 turns by rolling dice. Outcome of dice should be added into total scores of players.
4. Save each players record into stack.
5. Stack should be implemented using link list.
6. Finally pop all player name and scores from stack and print them as summery. 7. Use queue data structure as dice, Take input the number of values on the dice form the user. Queue should be implemented with the help of array (circular array).
8. To randomly select the value from the queue, we will rotate a loop up to a random value (obtained with the help of built in method rand( )
Guidelines:
Use stack data structure to save information of players. Each player will represent a node which will contain player name and scores.
Use queue data structure to save dice numbers and get random number from dice. Use circular array to implement queue.
Your solution should use these classes
i. Player (Node) Class: To save information of each player
ii. Stack Class: To save different players
iii. Queue Class: To save dice numbers given by user and get random number from dice.
Before calling rand() method use this line ( srand((unsigned) time(0)); ) to get different random numbers.
Note: Use the following libraries in your program.
#include
#include
#include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started