This document contains C++ code to implement stacks and queues using arrays.
The stack code defines a MAX size of 10, integer array stack of size 10, and variables to track the top index and elements. Functions are defined to push, pop, and display elements by manipulating the top index and array.
Similarly, the queue code defines a MAX size of 20, integer array queue of size 20, and variables to track the front, rear, and elements. Functions are defined to insert, delete, and display elements by manipulating the front, rear indexes and array.
Both implementations use do-while loops to get user input to call the push/pop, insert/delete, and display functions until the user
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
240 views
Stacks Using Array
This document contains C++ code to implement stacks and queues using arrays.
The stack code defines a MAX size of 10, integer array stack of size 10, and variables to track the top index and elements. Functions are defined to push, pop, and display elements by manipulating the top index and array.
Similarly, the queue code defines a MAX size of 20, integer array queue of size 20, and variables to track the front, rear, and elements. Functions are defined to insert, delete, and display elements by manipulating the front, rear indexes and array.
Both implementations use do-while loops to get user input to call the push/pop, insert/delete, and display functions until the user