Programming C

Tasks studies - laboratory


Project maintained by dawidolko Hosted on GitHub Pages — Theme by dawidolko

Exam 6

Create a data structure support for the “stack”.

Requirements.

1. The project should be made in the VS 2017 IDE.

2. The project should include:

a. Error and message handling.

b. Stack handling (Stack initialization, stack release, adding a new element, fetching the first element, finding the given element, saving all stack elements to disk in a binary file, reading from disk). At the same time, stack handling should not depend on the type of data placed in the stack. Use the void pointer for this *. Combining elements into a stack should be done through pointers (Do not use a stack created based on an array!).

c. Interface. Each stack handling procedure should be called from the appropriate

interface function. In addition, the interface should output stack elements and menus to the monitor.

d. Data. They should be presented in the form of a structure and contain handling functions (saving/reading a single object to/from disk, outputting to the monitor, initializing the object and releasing memory, comparing functions according to the given criterion when searching, etc.).

3. Each component of the project (a, b, c, d) should be presented as a separate pair of files (cpp, h), with the data being enclosed in the file and used in other files only through functions. All functions for each component of the project should be separated into external functions (will be used in other files) and internal functions (only in the file that handles this data). Internal functions should be enclosed in the appropriate files.

4. Use the MY STUDENT data structure, which contains the student’s name (text line), year of birth (int) and field of study (enum element, which points to an array of text lines with the names of individual fields of study). The text line “student’s name” should be dynamically allocated with a size corresponding to the number of characters in the name