On Thu, 2/5/2026 4:19 AM, Daniel70 wrote:
On 5/02/2026 12:01 am, Graham J wrote:
John wrote:
[snip]
European alphabet-based languages were easier to learn.ÿ The only disadvantages was the Roman numbering system which was clearly a barrier to numeracy
I thought Roman Numbering was rather simple. at least for the lessor numbers.
OK, write a program to convert decimal integers to Roman Numerals :-)
************* From the CoPilot House Of Programming ********************
/* gcc -o roman.exe roman.c */
#include <stdio.h>
void toRoman(int num, char *out) {
struct {
int value;
const char *symbol;
} map[] = {
{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"},
{100, "C"}, {90, "XC"}, {50, "L"}, {40, "XL"},
{10, "X"}, {9, "IX"}, {5, "V"}, {4, "IV"},
{1, "I"}
};
int i = 0;
out[0] = '\0';
while (num > 0) {
if (num >= map[i].value) {
num -= map[i].value;
strcat(out, map[i].symbol);
} else {
i++;
}
}
}
int main() {
int n;
char roman[32];
printf("Enter an integer: ");
scanf("%d", &n);
if (n < 1 || n > 9999) {
printf("Number out of range (1?9999)\n");
return 1;
}
toRoman(n, roman);
printf("The Roman numeral is: %s\n", roman);
return 0;
}
************* From the CoPilot House Of Programming ********************
What is interesting about this particular run, was the glacial rate the
output tokens were generated. I would scroll a line, it would fill it,
I would scroll another line, it would fill it. Must be running on a PC.
Untested :-)
The AI assures me 9999 ==> "MMMMMMMMMCMXCIX"
Paul
--- PyGate Linux v1.5.11
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)