cout << " Enter a number between 1 and 9 to see the corresponding Roman Numeral.\n";
cout << " Enter the number zero(0) to quit.\n";
cin >> romanNumeral;
do
{
switch (romanNumeral)
{
case 0:
cout << " SEE YA LATER.";
break;
case 1:
cout << " 'I' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 2:
cout << " 'II' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 3:
cout << " 'III' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 4:
cout << " 'IV' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 5:
cout << " 'V' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 6:
cout << " 'VI' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 7:
cout << " 'VII' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 8:
cout << " 'VIII' is the corresponding Roman Numeral for - " << romanNumeral;
break;
case 9:
cout << " 'IX' is the corresponding Roman Numeral for - " << romanNumeral;
break;
default:
cout << " Cannot Comply ";
break;
}
}while (romanNumeral >= 0 && romanNumeral = 9);
cout << " Enter Another Number.";
cin >> romanNumeral;
return 0;
}
Unsure why it womt compile. any suggeations would be appreciated Thanks in advance.
At a glance, your code appears to be fine. I did notice something though. Shouldn't these lines:
ashtrey4229 wrote:
1 2 3
cout << " Enter a number between 1 and 9 to see the corresponding Roman Numeral.\n";
cout << " Enter the number zero(0) to quit.\n";
cin >> romanNumeral;
(sic)
and these lines:
ashtrey4229 wrote:
1 2
cout << " Enter Another Number.";
cin >> romanNumeral;
I suggest that you change the parameters in the while loop to make more sense. It should be that romanNumerical is equal to 0 or more and equal to nine or less.
Another thing, you only need one "cin >> romanNumeral;" .
Put it at the beginning of the do while loop. Keep the cout << "Enter Another Number." where it's at.