I am writing a program to convert ints to roman numerals. this is the function that gets called when the user enters a number. it works just fine for number 1-99, but then it will either crash, or give bogus data for any numbers higher that 99. any pointers as to where i am going wrong with this?
string intToRoman(int num) {
string roman;
int h,t,o;
char *ones[] = {"","I","II","III","IV","V","VI","VII","VIII","IX"};
char *tens[] = {"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
char *hundreds[] = {"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
char *thousands[] = {"","M","MM","MMM","MMMM","MMMMM"};
if (num =< 5000) {
th = num / 1000;
h = num / 100;
t = num / 10;
o = num % 10;
roman = roman + thousands[th] + hundreds[h] + tens[t] + ones[o];
} else
roman = "Please enter a smaller number\n";
return roman;
}