fork download
  1. //Jeremy Huang CS1A Chapter 4, P. 220, #2
  2. //
  3. /**************************************************************
  4.  *
  5.  * CONVERT TO ROMAN NUMERAL
  6.  * ____________________________________________________________
  7.  * This program takes a user input from numbers ranging from
  8.  * 1 to 10 and converts the inputted number into their
  9.  * respective roman numeral.
  10.  * ____________________________________________________________
  11.  * INPUT
  12.  * num : number user inputs
  13.  *
  14.  * OUTPUT
  15.  * N/A : cout used to convert
  16.  *
  17.  **************************************************************/
  18. #include <iostream>
  19. using namespace std;
  20.  
  21. int main() {
  22. int num; //INPUT - number user inputs
  23.  
  24. //User Input
  25. cout<<"Enter a number from 1-10, integers only: "<<endl;
  26. cin>>num;
  27.  
  28. //Output Result
  29. switch (num)
  30. {
  31. case 1:
  32. cout<<"Roman numeral version: I";
  33. break;
  34. case 2:
  35. cout<<"Roman numeral version: II";
  36. break;
  37. case 3:
  38. cout<<"Roman numeral version: III";
  39. break;
  40. case 4:
  41. cout<<"Roman numeral version: IV";
  42. break;
  43. case 5:
  44. cout<<"Roman numeral version: V";
  45. break;
  46. case 6:
  47. cout<<"Roman numeral version: VI";
  48. break;
  49. case 7:
  50. cout<<"Roman numeral version: VII";
  51. break;
  52. case 8:
  53. cout<<"Roman numeral version: VIII";
  54. break;
  55. case 9:
  56. cout<<"Roman numeral version: VIV";
  57. break;
  58. case 10:
  59. cout<<"Roman numeral version: X";
  60. break;
  61. }
  62. return 0;
  63. }
Success #stdin #stdout 0s 5328KB
stdin
10

stdout
Enter a number from 1-10, integers only: 
Roman numeral version: X