Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do this in C, this is all one question, please separate the files clearly so I know that this code belongs to this file.

Please do this in C, this is all one question, please separate the files clearly so I know that this code belongs to this file. I will thumb up your hard work if the code works, please allow others to try if you are not sure how. Comments that help in explaining are greatly appreciated. I use visual studio 2022. Thanks!!

Create a struct to represent users in a game. What is required of each person is their unique username, their level (levels can range from 1 60), and their faction (red, blue, or green).

Implement a set of functions in a queue.c file which defines the required operations of an abstract data type queue. The queue should be created as a struct containing two node pointers: for the head and tail of the queue. The queue should be created from a set of linked nodes. The queue will require at minimum:

A function to initialize a blank queue A function to check if the queue is empty A function to enqueue a node A function to dequeue a node Create a struct to represent a queue node. This structure contains a node pointer and a user struct as its data.

Write a function to enqueue the queue with a number of randomly created users. You will need to pass this function a pointer to an initialized queue, and the number of users to add to the queue. The number of users to add to the queue is to be passed to the program as a command line argument. Each user should be randomly generated (for the username you can randomly select a set number of letters and numbers. I.e., you can hardcode in all usernames are 10 characters in length, for example.). This function returns 0 if it succeeds, and non-zero if something goes wrong.

Write a testing main() function which initializes the queue, calls the function to add users to the queue (and reports if an error occurred), and then dequeues from the function one at a time until the queue is empty. After each dequeue, print on the screen the username, level and faction of the user that was dequeued.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Different formulas for mathematical core areas.

Answered: 1 week ago

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago