项目作者: henryblue

项目描述 :
Simple Console Calculator using C++
高级语言: C++
项目地址: git://github.com/henryblue/Calculator.git
创建时间: 2016-10-18T12:02:47Z
项目社区:https://github.com/henryblue/Calculator

开源协议:Apache License 2.0

下载


Calculator

Simple Console Calculator using C++

ClassMap

  • Node Class diagram, include Number Node, Operator node(Binary Node, UnaryNode and Multiple Node) and variable node.



  • Scanner class is responsible for the expression of the scan, Parser class is parse the expression to the corresponding node.



  • These classes are mainly responsible for the storage of data, including the function and variable. Serialize class nmake the storage of data can serialize



How to use

Recogniaed Commands

  • !h: Help
  • !quit: quit
  • !v: show variable list
  • !f: show funcation list
  • !load filename: load file
  • !save filename: save variable and funcation to file

Example

  1. >> 123+7-10*8-10+9*(4-3)/4
  2. 42.25
  3. >>-10*7+4-10
  4. -76
  5. >>a=4
  6. 4
  7. >>b=3
  8. 3
  9. >>a+b-3*5/3
  10. 2
  11. >>e*10/2
  12. 13.5914
  13. >>cos(100)*10-sqrt(4)
  14. 6.62319
  15. >>!f
  16. fucation list:
  17. log
  18. log10
  19. exp
  20. sqrt
  21. sin
  22. cos
  23. tan
  24. sinh
  25. cosh
  26. tanh
  27. asin
  28. acos
  29. atan
  30. >>e
  31. 2.71828
  32. >>pi
  33. 3.14159
  34. >>a
  35. 4
  36. >>b
  37. 3
  38. >>!save test.txt
  39. save "test.txt".
  40. >>!load test.txt
  41. load "test.txt".
  42. >>!quit

Liense

  1. Copyright 2016 henryblue
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.