This project is used to let you queue, process, undo, and inspect tasks in real time.
Under the hood it showcases classic data‑structure interplay:
| Structure | Role | File |
|---|---|---|
| Queue (FIFO) | Holds pending tasks, sorted by arrival order | queue.c / queue.h |
| Stack (LIFO) | Holds completed tasks so the last one can be undone instantly | stack.c / stack.h |
The program’s modular design (separate headers for the scheduler core, queue, stack, and utility helpers) makes it easy to extend—e.g., add persistence, deadlines, or different scheduling policies.
| Menu # | Action | What Happens |
|---|---|---|
| 1 | Add a Task | Collects a task name + priority (1‑5). Rejects empty or duplicate names. |
| 2 | Process a Task | Dequeues the next pending job, echoes it, then pushes it onto the completed stack. |
| 3 | Undo Last Completed | Pops the stack and re‑queues the item so it becomes pending again. |
| 4 | View Pending | Pretty prints the queue with running numbers and priorities. |
| 5 | View Completed | Shows the stack (top → bottom) so you can track all finished work. |
| 6 | Exit | Frees every dynamically allocated node in both structures before terminating. |
- Pure C11 – no third‑party libraries, ready for GCC, Clang, or MSVC.
- Safety First – every
mallocchecked, everyfgetstrimmed, priorities ranged 1‑5. - Undo Without Drama – the stack/queue combo demonstrates clear separation of concerns.
- Teaching‐Ready – perfect for labs on linked lists, stacks, queues, or menu‑driven UIs.
Windows User:
- Download VS Code and C/C++ Extension in VS Code.
- Download MinGW. Link: https://sourceforge.net/projects/mingw/
- In Terminal, type gcc Book_Catalog.c -o Book_Catalog.exe for compile the program and build the executable.
- In Terminal, type .\Book_Catalog.exe to run the program.
Mac User:
- Open Terminal, type xcode-select --install to install the Command Line Tools.
- In Terminal, type gcc Book_Catalog.c -o Book_Catalog for compile the prgram and build the executable.
- Lastly, type ./Book_Catalog to run the program.
Feel free to fork and add advanced scheduling algorithms or persistence.