Hello,

I am currently assigned a project to simulate a carwash in C++ using a priority queue and a heap. Basic synopsis:
1. a car enters the carwash.
2. if there are no parking spaces the car departs (must keep track of number of
cars that depart without getting a wash).
3. if there is parking the car parks and waits for the next available wash bay.
4. The service (wash, wax, and or vacuum) is performed and the vehicle departs and
the process continues.

The simulation must keep track of all of the above actions for a final report containing
number of customers who successfully complete each type of task as well as the number of
customers who depart without doing anything.

I've got the queue for parking spaces operating but am having problems even getting started with the priority queue and the heap usage. Any assistance would be appreciated.

Recommended Answers

All 2 Replies

Thanks for your assistance David. I have spent more time in the past couple of days learning more about priority queues than I wanted to know. I believe I have an approach now.

A priority queue acts just like a queue but rather than maintain the order that the items were added to the queue, the priority queue sorts the items as they are added. Here is an example:
http://programmingexamples.net/index.php?title=CPP/STL/PriorityQueue

As I understand, a heap is the same as a priority queue.

Good luck,

David

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.