Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int num;
  7.  
  8. // Ask user to input a number.
  9. cout << "Enter a number within the range of 1 through 10,\n";
  10. cout << "and I will display the Roman numeral version of that number.\n";
  11. cin >> num;
  12.  
  13. switch(num)
  14. {
  15. case 1 : cout << "The Roman numeral version of " << num << " is I.\n";
  16. break;
  17. case 2 : cout << "The Roman numeral version of " << num << " is II.\n";
  18. break;
  19. case 3 : cout << "The Roman numeral version of " << num << " is III.\n";
  20. break;
  21. case 4 : cout << "The Roman numeral version of " << num << " is IV.\n";
  22. break;
  23. case 5 : cout << "The Roman numeral version of " << num << " is V.\n";
  24. break;
  25. case 6 : cout << "The Roman numeral version of " << num << " is VI.\n";
  26. break;
  27. case 7 : cout << "The Roman numeral version of " << num << " is VII.\n";
  28. break;
  29. case 8 : cout << "The Roman numeral version of " << num << " is VIII.\n";
  30. break;
  31. case 9 : cout << "The Roman numeral version of " << num << " is IX.\n";
  32. break;
  33. case 10 : cout << "The Roman numeral version of " << num << " is X.\n";
  34. break;
  35. default : cout << "Error!";
  36. cout << "This program does not accept numbers\n";
  37. cout << "less than 1 or greater than 10.\n";
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement