Guest User

Untitled

a guest
Sep 26th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int original = 0;
  9. char table[][3] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
  10. int tablen[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
  11. do {
  12. cout << "Число от 1 до 3999 ";
  13. cin >> original;
  14. } while (original < 1 || original > 3999);
  15. for (int i = 0; i < 13; i++) {
  16. while(original/tablen[i]){
  17. cout << table[i];
  18. original -= tablen[i];
  19. }
  20. }
  21. cout << endl;
  22. return 0;
  23. }
Add Comment
Please, Sign In to add comment