C代写:COMP1917 Using Abstract Data Types

一个关于ADT(Abstract Data Types)的Lab小作业,用Stack实现一个Breakfast pancake的小程序。


In this Lab, you will perform operations on a data type through pointers to the struct and an interface. You will also implement the functions in a given interface, allowing for other users to access your struct without knowing how it has been defined.

Step 1

Create a directory called lab8, and cd to this directory.

Step 2

Download the files from the lab8 directory. Read through the provided code to understand the existing functionality and how you should implement the interface. You are given 5 files: two interface files Pancake.h Stack.h, two implementation files Pancake.c Stack.c and a driver program breakfast.c. Function definitions in Pancake.c have already been written for you and you can use them to help you. Take your time to read through the code and understand what it’s doing.
Your task is to implement the functions in Stack.c. Use breakfast.c to call your functions and confirm that everything is working correctly. We have outlined a framework and gave some hints of what things you should test, but feel free to expand it or change completely. To compile multiple files together we issue the following command

gcc -Wall -Werror -o breakfast breakfast.c Pancake.c Stack.c

Note: Do not modify function prototypes Stack.c or any definitions in Stack.h. You will only submit Stack.c which we compile with our version of breakfast.c and default stubs.

Step 3

For the second task of the lab you will use your debugging skills to fix debug.c available here. The program reads in students ids and their mark for each course and calculates their wam. It then display how many people failed and who has the highest wam. Most of the errors can be fixed by reading through compile errors but there are a couple algorithmic errors as well. This link provides great information about compile errors. You can compile with

gcc -Wall -Werror -o debug debug.c 2> errors.txt

to redirect error output to a file. You need to show your working program to your tutor to get marked off. Credit goes to Alex Linker for this amazing challenge. Show your work to your tutor and submit it.