Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- int main() {
- int original = 0;
- char table[][3] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
- int tablen[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
- do {
- cout << "Число от 1 до 3999 ";
- cin >> original;
- } while (original < 1 || original > 3999);
- for (int i = 0; i < 13; i++) {
- while(original/tablen[i]){
- cout << table[i];
- original -= tablen[i];
- }
- }
- cout << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment