This program implements a simple stack data structure to manage a list of countries. Users can push a country onto the stack, pop a country from the stack, search for a country by name, and display the list of countries.
The program uses a stack to store countries, where each country is represented by a structure with a character array to store its name. The maximum size of the stack is defined by MAX_Country_SIZE.
- push(): Adds a new country to the top of the stack.
- pop(): Removes the country from the top of the stack.
- search(): Searches for a country by name in the stack.
- display(): Displays the list of countries in the stack.
- main(): The main function presents a menu to the user and calls corresponding functions based on the user's choice.
- Compile the program using a C compiler (e.g., gcc).
- Run the compiled executable.
- Follow the on-screen menu to perform operations on the country stack.
- Choose the 'Exit' option to end the program.
The program does not handle spaces in country names during input. It assumes a single word as the country name. The stack size is limited to MAX_Country_SIZE, and attempting to push more countries than the defined size will result in a stack full message. The search function performs a case-sensitive comparison when searching for countries by name.
Ashiqur Rahman
- Group 04
Date : 03-12-2023