Project: Roman Numerals
Ancient Rome used a system of numbers much different that the Hindu-Arabic numerals we use today. Today Roman Numerals are only used on movie copyrights, Olymipic games and the Superbowl. Write a program that converts the numbers from 1-2500 to [[Roman Numerals]] and prints them. Write a function that specifically does the Roman Numeral conversion. It should take an integer and return a string. The following table specifies the Roman Numerals and their corresponding integer values.
Symbol | Value |
---|---|
I | 1 |
IV | 4 |
V | 5 |
IX | 9 |
X | 10 |
XL | 40 |
L | 50 |
XC | 90 |
C | 100 |
CD | 400 |
D | 500 |
CM | 900 |
M | 1000 |
With the right algorithm, generating Roman Numerals with the subtractice notation illustrated above is as simple as the additive form.
Output
$ swiftc RomanNumerals.swift -I . -L . -lUtils
error: link command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lUtils
clang: error: linker command failed with exit code 1 (use -v to see invocation)