CSC 270

Homework 2
assigned 8 Oct, due 22 Oct

Modify your previous calculator program (homework 1) to take input and produce output in Roman numerals. You should be able to do this by writing two functions named "read_roman" and "write_roman" (or something like that) and calling them in place of some of the calls to "scanf" and "printf" in your old program. Write a program in C to do simple arithmetic interactively. The user will type an operator (+, -, or *), then two integers in Roman-numeral notation, separated by spaces. The program will print out the answer, also in Roman numerals, in a suitably informative format. Example:

panther% hw2
+ XV IV
XV + IV = XIX
panther% hw2
- XIX VIII
XIX - VIII = XI
panther% hw1
* VI III
VI * III = XVIII
panther%

Note that Roman numerals don't normally handle negative numbers or non-integers, although those are two enhancements you might want to make to your program for extra credit.

The grading criteria are roughly the same as for homework 1.


Last modified: Tue Oct 8 09:24:07 EDT 1996
Stephen Bloch / sbloch@boethius.adelphi.edu