I have a test due in about four hours and one of the questions asks us to convert a user-inputed integer up to 100 into a roman numeral. I think my code is very close (I fou
Function to Convert Decimal to Roman Numrals string toLongRoman(int x) {
string Romanvalue;
string Roman[13] = { "M","CM","D","CD", "C","XC", "L","XL", "X","IX","V","IV", "I" };
int Numbers[13] = { 1000, 900, 500,400, 100,90,50,40,10,9,5,4,1 };
for (int index = 0; index < 13; index++) {
while (x >= Numbers[index]) {
Romanvalue += Roman[index];
x -= Numbers[index];
}
}
return Romanvalue;