c++ program converting the date to roman numerals

I need some help with a program to convert a date entered into roman numerals. I can only use one output prompt to get the date, so that makes it more difficult. Here is what i have, but i have no idea how to go about the rest of it. Any help or input would be greatly appriciated!

-----------------------------------------------------------------

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int array_date[20];
char I; // one
char V; // five
char X; // ten
char L; // fifty
char C; // one hundred
char D; // five hundred
char M; // one thousand

void entry(int []);
int date(int []);

int main()
{
entry(array_date);

system("PAUSE");
return 0;
}
void entry(int array_date[])
{
cout << "enter the date: " << endl;
cin >> array_date;

while(array_date>=1000){
roman += "M";
number-=1000;
}
while(array_date>=900){
roman += "CM";
number-=900;
}
while(array_date>=500){
roman += "D";
number-=500;
}
while(array_date>=400){
roman += "CD";
number-=400;
}
while(array_date>=100){
roman += "C";
number-=100;
}
while(array_date>=90){
roman += "XC";
number-=90;
}
while(array_date>=50){
roman += "L";
number-=50;
}
while(array_date>=40){
roman += "XL";
number-=40;
}
while(array_date>=10){
roman += "X";
number-=10;
}
while(array_date>=9){
roman += "IX";
number-=9;
}
while(array_date>=5){
roman += "V";
number-=5;
}
while(array_date>=4){
roman += "IV";
number-=4;
}
while(array_date>=1){
roman += "I";
number-=1;
}
Here is rosettacode example modified for C++11:
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
#include <iostream>
#include <string>
#include <utility>

std::string to_roman(int value)
{
    static const std::pair<int, const char*> romandata[] ={
        {1000, "M" }, { 900, "CM"},
        { 500, "D" }, { 400, "CD"},
        { 100, "C" }, {  90, "XC"},
        {  50, "L" }, {  40, "XL"},
        {  10, "X" }, {   9, "IX"},
        {   5, "V" }, {   4, "IV"},
        {   1, "I" },               };
    std::string result;
    for (const auto& current: romandata)
        while (value >= current.first) {
            result += current.second;
            value  -= current.first;
        }
    return result;
}

int main()
{
    for (int i = 1; i <= 4000; ++i)
        std::cout << to_roman(i) << std::endl;
}
http://rosettacode.org/wiki/Roman_numerals/Encode#C.2B.2B
Topic archived. No new replies allowed.