Show us what you have and use the code dialog box ( see < / > in the post editor menu next to the smiley face.
This is a common CS problem for introductory classes.
Have you tried the simpler approach of generating the numbers:
I, II, III, IIII, V, VI, VII, VIII, VIIII, X ...
and then looking for the ?IIII pattern and replacing it with the I(?+1) so that IIII is 0IIII which then transforms into IV and VIIII transforms into IX. Actually its a bit more general as you need to find any four repetitions and replace.
As an example, 1980 would be M-DCCCC-LXXX but DCCCC is written as CM and so the answer is M-CM-LXXX.
Using the simpler approach, you can then use modulo arithmetic to break a number down into its 1000*a + 500*b + 100*c + 50*d + 10*e + 5*f + g and then translate that to M*a + D*b + C*c + L*d + X*e + V*f + I*g where a,b,c,... are the number of times to repeat the roman numeral symbol.
I'm sure there are other more efficient approaches that can be found online.