help please, simple C program, seeking help to write a function to convert any given year into its roman equivalent
Posted on 2004-08-14
I am trying to write a general purpose function to convert any given year into its roman equivalent.
Decimal Roman decimal roman
1 i 100 c
5 v 500 d
10 x 1000 m
Example 1: 1988 = mdcccclxxxviii>>m=1000, d+c+c+c+c=900, l+x+x+x=80, v+i+i+i=8 total 1988.
Example 2: 1525 = mdxxv.
My question is how will I return this value? (mdcccclxxxviii or what ever I get for the equivalent years) ?
Suppose the name of the function is roman()
So if I write a program like this.
/*pass the value to the function*/
char roman(int n)
/*code for converting the year to roman*/
here is my problem how will I return the value since it will be something like a string, ?
Or are there any other method to do this? I just started learning C and all I know is loops, functions , swirch and the if-else (decision controls). I have to do solve this using the these tools.
Please don’t write the code for this, just guide me the proper way. Thanks a lot in advance