1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <string>
using namespace std;
int main ()
{
int x , bconv, use;
char ones[9] = {'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'};
const char tens(9) = {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
const char hunds[9} = {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
const char thous[9} = {"M", "MM", "MMM", "Mv", "v", "vM", "vMM", "vMMM", "xM"};
cout << "Enter an Arabic number: ";
cin >> use;
bconv = use;
cout << endl;
cout <<endl<<"Please wait..."<<endl<<endl;
Sleep (3000)
cout << "Your number ("<<use<<") in Roman numerals is:"<<emdl<<endl;
cout << "\t";
if (bconv >= 1000)
{
x = bconv/1000;
if (x == 0)
{
continue;
}
else
{
x--;
cout << thous[x];
}
bconv = bconv - (x*1000);
}
else
continue;
if (bconv >= 100)
{
x = bconv/100;
if (x == 0)
{
continue;
}
else
{
x--;
cout << hunds[x];
}
2bconv = 2bconv - (x*100);
}
else
continue;
if (bconv >= 10)
{
x = bconv/10;
if (x == 0)
{
continue;
}
else
{
x--;
cout << tens[x];
}
use = use - (x*10);
{
else
continue;
if (bconv >= 1)
{
x = bconv/1000;
if (x == 0)
{
continue;
}
else
{
x--;
cout << ones[x];
}
use = use - (x*1);
}
else
continue;
system ("pause");
return 0;
}
|