//Maxwell Brewer CS1A Chapter 4, P. 220, #2
//
/***************************************************************
*
* CONVERT ROMAN NUMERALS
* _____________________________________________________________
*
* This program will take a number between 1 and 10, then
* convert it to the equivalent Roman Numeral using an
* infinite while loop and switch statement.
* _____________________________________________
* INPUT
*
* number (1-10)
*
* OUTPUT
*
* number (I-X)
*
***************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
// Initialization
const char ENT_NUM[] = "Enter a number (1-10): ";
const char MSG_ROM[] = "The Roman Numeral is: ";
const char MSG_ERROR[] = "Invalid entry";
int number;
// Display input prompts
cout << ENT_NUM;
cin >> number;
// Output
while (1)
{
cout << MSG_ROM;
switch (number)
{
case 1: cout << " I " << endl;
break;
case 2: cout << " II " << endl;
break;
case 3: cout << " III " << endl;
break;
case 4: cout << " IV " << endl;
break;
case 5: cout << " V " << endl;
break;
case 6: cout << " VI " << endl;
break;
case 7: cout << " VII " << endl;
break;
case 8: cout << " VIII " << endl;
break;
case 9: cout << " IX " << endl;
break;
case 10: cout << " X " << endl;
break;
default: cout << MSG_ERROR << endl;
break;
} break;
}
return 0;
}