i have a project due in a few hours. the project was to take a file that had roman numerals and numbers in it and write a program that contained functions to convert roman to numbers and numbers to roman numeral and then write it back to the same file with a specific format. so if my file had IV 5 IX in it, when the program writes it back into the file its suppose to look like this
IV 4
V 5
IX 9.
what i decided to do was write it to a new file and once it reach end of file for the old file it will delete the old file and rename the new one the same name as the old file. but for some reason it doesnt format correctly. for example if my old file had IV X 9 4, it will come out like this
IV
IV 4
X
X 10
IX 9
IV 4
my conversion works the way i want it and i know my code could probably be better but at this point i dont have time to rewrite it. please help me figure out why its doing this.
@LendraDwi how would that help? could you elaborate a bit please. the final file is formatting correctly its just that if the old file has IV 4 I X
it formats like this:
IV
IV 4
IV 4
I
I 1
X
X 10.
the problem is that the first roman numerals that are by themselves aren't suppose to be there. its like they are being copied over from the old file when they arent supposed to be.
Sorry I miisread some part
I think you need to store the inputted value and return value from both of your functiion, and write them under 1 loop in main
is this really the only way? to be honest im not good with functions yet so this took me a really long time to write and with the few hours i have left i dont think i can rewrite the whole code if i need to.