Go to the source code of this file.
int fromRoman |
( |
const char * |
s | ) |
|
Converts a roman numeral to a value.
- Parameters
-
s | Roman numeral to convert. |
Definition at line 39 of file roman.cpp.
40 int i, n = (int)strlen(str);
41 short * num= (
short *) calloc(n,
sizeof(
short));
42 for (i = 0; str[i]; i++) {
76 for (i = 1; str[i]; i++) {
77 if (num[i] > num[i-1]) {
83 for (i = 0; str[i]; i++) {
Checks if a string is a roman numeral.
Definition at line 31 of file roman.cpp.
32 char *ch = (
char*)str;
33 for (; *ch && (!maxchars || (ch-str) <= maxchars); ch++)
34 if (!strchr(
"IVXLCDMivxlcdm ", *ch))