Prime_ total

#include <iostream>
using namespace std;

int main()
{

int romanNumeral;

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.


closed account (zb0S216C)
ashtrey4229 wrote:
romanNumeral = 9 (sic)

Did you mean: '=='?

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;
(sic)


be within the loop?

Wazzak
Last edited on
WARNING: SPOILER ALERT!




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.
Topic archived. No new replies allowed.