https://github.com/marchellodev/kse_ds_stack_n_str_calculator
https://github.com/marchellodev/kse_ds_stack_n_str_calculator
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/marchellodev/kse_ds_stack_n_str_calculator
- Owner: marchellodev
- Created: 2022-01-17T08:53:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T09:32:44.000Z (over 4 years ago)
- Last Synced: 2026-01-03T08:52:03.431Z (6 months ago)
- Language: C++
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KSE Algorithms Homework #1
[Task](https://github.com/kse-ua/algorithms/blob/main/assignments_2021/assignment_1.md)
- Define and implement a `Stack` data structure
- Implement a calculator, that takes in a string (i.e. `2 * (3 + 7 - 1)`) and returns the result (i.e. `18`)
## Running
Note: The program uses Linux's readline ([for better editing experience](https://stackoverflow.com/a/7463298)), so it'll only work on Linux machines (maybe also MacOS, I am not sure). Please refere to commit [03a63c](https://github.com/marchellodev/kse_ds_stack_n_str_calculator/commit/03a63cd70a8fde953db16b783bda6e2cb50ca070) when trying to run this thing on an OS other than Linux.
```shell
# Cleanup
rm Makefile kse_alg_1 cmake_install.cmake CMakeFiles CMakeCache.txt cmake-build-debug bin CTestTestfile.cmake _deps testing lib testing\[* -rf
# Building & Running
cmake .
make
./kse_alg_1
```
## TO-DO
- [ ] Use custom data structure instead of `vector<>` for lists
- [ ] Define `Queue` and use it instead of `vector` for the Shunting-yard algorithm
- [ ] Implement testintg
## Tested on the following inputs:
```shell
2 + 3 5
2 * (3 + 7 - 1) 18
2 + (3 * (8 - 4)) 14
3 + 4 * 2 / (1 - 5)^2^3 3
# additional task
3 -- 2 5
```