The data for this c program should be read from stdin (using scanf). The data "file" will include two types of commands, namely enqueue and dequeue. Each data record (think line of input if you like) will be either an enqueue or a dequeue command. In addition to the "command" each data record will include a time. Enqueue commands will also include a name. Below, I've included both an enqueue and dequeue command as they might appear in the data.
example of input:
09:14 enqueue Sweany
09:17 enqueue Mikler
09:19 dequeue
The program will maintain the queue and print a mesage (to standard output) for each command seen. One last specification on the data is that the times will be listed in ascending order in the data file/stream. Below is a copy of a data file followed by the associated output that your program should generate for that file.
example of output:
Sweany entered the Queue at 09:14
Mikler entered the Queue at 09:17
Sweany, who entered the Queue at 9:14, dequeued, receiving service at 09
Comments
Leave a comment