#include <cstdlib>
#include <iostream>
using namespace std;
int umrechnung ( int dezimal );
int main(void)
{
int dezimal;
cout << "Hallo bitte geben sie die Zahl ein " << endl;
if (!(cin >> dezimal)) {
cout << "Falsche Eingabe! " << endl;
system("pause");
return 0;
}
umrechnung ( dezimal );
system("pause");
return 0;
}
int umrechnung( int dezimal ) {
int var1=0;
int array1[16] = {5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
char array2[16][3] = { "A", "MA", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
for (int i=0;dezimal>0;) {
if ( !((dezimal-array1[i])>-1) ) {
i++;
continue;
}
cout << array2[i];
dezimal = dezimal-array1[i];
var1++;
}
cout << endl;
return 0;
}