C++ calculator for four operations

Asked 2 years ago, Updated 2 years ago, 24 views

It's not a post for help on the source.

As a task, I have to make a calculator that supports calculations of '+', '-', '*', '/', and '('). You have to make it based on what you learned in the previous class.

Most of the four-point calculators use a stack, etc., to convert the formula shown in the median notation into a backward notation, and then do the calculations I'm getting drunk, but the problem here is the "stack." We've never learned about stacks in class, we've never implemented them.

It's not that I can't implement it. You can just take it and use it. But now that I've learned the underlying grammar that can implement the stack, can I implement the calculator by implementing the stack at will? What's the intention? Hmm...

Even if you don't use a stack, it's essentially calculating the principle of a stack Is there anyone who has just broken it down without using a stack, interpreted it as the median notation, and implemented a calculator?

c++

2022-09-22 18:37

2 Answers

There is a STL of C++ called stack (no need to be implemented). All you have to do is include.)

*Reference: http://hyeonstorage.tistory.com/321

You don't have to pay attention to brackets and computational priorities if you use backward notation Median notation has to deal with the number of cases because you have to weigh parentheses and priorities.


2022-09-22 18:37

I think the most accurate way to determine the intent of the problem is to ask the professor directly. I think you will be free to tell me the intention of the problem or whether it can be converted into a backward notation.


2022-09-22 18:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.