CGI calculator
This program implements a simple, web-based CGI calculator. The user can input two numbers, and either:
- add them, or
- subtract one from the other, or
- multiply them, or
- divide one by the other, or
- raise one to the power of the other
The program does not depend on an existing HTML interface; calling the program without supplying any input will cause it to generate its own HTML interface, which can then be used to enter calculations.
This program uses the same CGI helper functions as the other programs in the CGI section of this site.
Programming Issues
The CGI programming issues involved are fairly basic:
- Getting and verifying user input
- Handling bad input cleanly
- Outputting the desired HTML
Usage
Place the program in the cgi-bin (or equivalent) directory on your web server, and call it without input when invoking for the first time.