Skip to content
Snippets Groups Projects
Commit 7cd41a6c authored by Nathan's avatar Nathan
Browse files

week 11

parent e153b459
No related branches found
No related tags found
No related merge requests found
......@@ -23,18 +23,17 @@ int main(){
}
```
The marking scheme for this session is as follows:
- Task 1 : 40 marks
- Task 2 : 60 marks
- Task 3 : 0 marks
A project is provided for you at the following link:
https://gitlab.uwe.ac.uk/br-gaster/worksheet5_tasks
# Stacks
......@@ -45,18 +44,11 @@ When creating a stack of plates, you can only access the last plate that was pla
Given a stack of plates we can do the following:
- Add a plate to the top (push)
- Take a plate from the top (pop)
- Count the number of stacked plates (size)
- Check if there are any plates at all (empty)
- Check if the stack is as high as is possible (full)
These analogous operations represent the functions we require to implement a stack.
......@@ -65,19 +57,12 @@ By then researching reverse Polish notation we can use the stack data structure
# Notes on Classes
For an introduction to Classes you should watch the lecture [here](https://uwe.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=90cfe1db-c303-4dac-8250-ade700f7c3a5).
### Using a class
Remember, as discussed in a lecture. Writing a class is like a blueprint. To use you class you need to create an instance of a class (in a similar way to how you declare a variable). You do this by providing the name of the class and then a name for you instance:
```c++
ClassName instance_name;
......@@ -85,13 +70,9 @@ ClassName instance_name;
```
To call member functions, you will need to use the scope operator:
```c++
instance_name.function_call();
......@@ -172,7 +153,6 @@ Please also refer to the Readme.md that you can view on the gitlab page for your
**Task 2 -** Using your stack class, implement the reverse polish notation calculator.
- You can find a good explanation of RPN in the related [wikipedia article (here)](https://en.wikipedia.org/wiki/Reverse_Polish_notation) and the popular computer science Youtube channel Computerphile also has an excellent video on how RPN is related to stacks [here](https://www.youtube.com/watch?v=7ha78yWRDlE).
- You need to implement the ```rpn_eval(std::string expr)``` function, found in ```rpn.cpp```. This function receives the expression that is input in the web client and you should return the answer as a string.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment