Desk Calculator Project

As an extended exercise - a mini project - we implement and extend a simple desk calculator. Please download the newest version, build it and work with it. If you find bugs or design flaws or if you want to suggest new features, please feel free to update this page (and add your signature to your remarks).

Version 1

Mini project structure with a Makefile, header files and implementation files. No new features compared to version 0.

  • Features:
    • evaluation of expressions with +, -, *, -, (, )
    • definition of variables, e.g. a = expression
    • predefined constants 'pi' and 'e'
    • concatination of expressions with ;
  • Examples:
    • r = 17
    • pi*r*r

  • change log
    • Split the source in header and implementation files and add a Makefile

  • To Do, Request for new features
    • Provide a distribution archives in addition to the source files. -- KilianSchwarz 07 Apr 2005
    • The value for pi can be modified by user; probably this should not be the case.
    • the program has limited number of variables (5) which an user can define -- done, see recommendations -- DennisKlein - 23 Apr 2005
    • if symbol table gets full, remove the oldest symbol ( 0th element of the array ) and make place for new one
    • include 'linux shell-like' history feature and make lines typed by the user earlier available by pressing arrows "up" or "down" -> new tokens ( say up to 20 lines )
  • Bugs

    • "2+3=" returns "5"; "d=5" and "d+3=" returns "8"; BUT "d=5" and "3+d=" returns "Error:Primary expected".
    • "7=a" is allowed. Should not be allowed.
    • ...

  • Recommendations


Version 0

First impementation in one source file. Use only constructs we know from lectures 'Basics I & II'.
  • Features:
    • evaluation of expressions with +, -, *, -, (, )
    • definition of variables, e.g. a = expression
    • predefined constants 'pi' and 'e'
    • concatination of expressions with ;
  • Examples:
    • r = 17
    • pi*r*r

  • To Do, Request for new features


-- PeterMalzacher - 07 Apr 2005
Topic revision: r5 - 2005-04-23, DennisKlein
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)