Error in converting numbers to roman numerals

So I am confused on the error I am getting. I have written two functions: one is the main but the other is roman_conversion. I have some sort of error here and have no idea what it means. I am in my 2nd month of school c++ programing.

So I think I am identifying or misusing my roman_conversion function wrong and the error comes up at line 13. Please help me with this part.

Thank you

 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 #include #include using namespace std; int i=0, j, number; int nof1000, nof500, nof100, nof50, nof10, nof5, nof1; char roman_result[100000]; int roman_conversion(char, int); //This my other function that will assign a letter to the roman_result array int roman_conversion(char RC, int num) int j; for (j=0; j=1000) { nof1000=number/1000; roman_conversion('M',nof1000); number=number-nof1000*1000; } else if (number>=500) { if (number>=900){ roman_result[i++]='C'; roman_result[i++]='M'; number=number-900; } else{ nof500=number/500; roman_conversion('D',nof500); number=number-500; } } else if (number>=100) { if (number>=400){ roman_result[i++]='C'; roman_result[i++]='D'; number=number-400; } else{ nof100=number/100; roman_conversion('C',nof100); number=number-100; } } else if (number>=50) { if (number>=90){ roman_result[i++]='X'; roman_result[i++]='C'; number=number-90; } else{ nof50=number/50; roman_conversion('L',nof50); number=number-50; } } else if (number>=10) { if (number>=40){ roman_result[i++]='X'; roman_result[i++]='L'; number=number-40; } else{ nof10=number/10; roman_conversion('L',nof10); number=number-10; } } else if (number>=5) { if (number>=9){ roman_result[i++]='I'; roman_result[i++]='X'; number=number-9; } else{ nof5=number/5; roman_conversion('V',nof5); number=number-5; } } else if (number>=1) { if (number>=4){ roman_result[i++]='I'; roman_result[i++]='V'; number=number-4; } else{ nof1=number; roman_conversion('I',nof1); number=number-1; } } cout<<"The roman numeral equivalent is "; //This should print out the results of the array roman_result depending on the value of j for (j=0;j
It looks like on line 14 you have a comma where you should have a semi-colon in your for loop:

You have: for (j=0; j<num, j++)

You should have: for (j=0; j<num; j++)

I'm not sure if this will solve your problem completely but it will sure cause a compile error.
Well I corrected that and so thank you. I found it to be the {} that was needed in the new function area.

Thank you again

Topic archived. No new replies allowed.