fork download
  1. //Conrad Taylor CSC5 Chapter 4, P. 220, #5
  2. //
  3. /*******************************************************************************
  4.  * Number Size Comparitor
  5.  * _____________________________________________________________________________
  6.  * This program converts numbers from input and converts them to roman numerals
  7.  * and outputs the result.
  8.  * _____________________________________________________________________________
  9.  * INPUT
  10.  * userNum
  11.  *
  12.  * OUTPUT
  13.  * romanNumerals
  14.  
  15.  ******************************************************************************/
  16. #include <iostream>
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21.  
  22. int userNum;
  23.  
  24.  
  25. cout << "Enter a number between 1 and 10: ";
  26. cin >> userNum;
  27.  
  28.  
  29. switch (userNum)
  30. {
  31. case 1:
  32. cout << "The Roman numeral I ";
  33.  
  34. break;
  35. case 2:
  36. cout << "The Roman numeral is II ";
  37.  
  38. break;
  39. case 3:
  40. cout << "The Roman numeral is III ";
  41.  
  42. break;
  43. case 4:
  44. cout << "The Roman numeral is IV ";
  45.  
  46. break;
  47. case 5:
  48. cout << "The Roman numeral is V ";
  49.  
  50. break;
  51. case 6:
  52. cout << "The Roman numeral is VI ";
  53.  
  54. break;
  55. case 7:
  56. cout << "The Roman numeral IS VII ";
  57.  
  58. break;
  59. case 8:
  60. cout << "The Roman numeral VIII ";
  61.  
  62. break;
  63. case 9:
  64. cout << "The Roman numeral is IX ";
  65.  
  66. break;
  67. case 10:
  68. cout << "The Roman numeral is X ";
  69.  
  70. break;
  71. default:
  72. cout << "You must enter a number between 1 and 10\n";
  73. cout << "try again.\n";
  74. break;
  75. }
  76.  
  77. return 0;
  78. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Enter a number between 1 and 10: You must enter a number between 1 and 10
try again.