Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
How to convert Roman numerals to Integer in C#
without any built-in function and step by step

What I have tried:

How to convert Roman numerals to Integer in C#
without any built-in function and step by step
Posted
Updated 29-Dec-21 7:29am
Comments
BillWoodruff 28-Dec-21 2:49am    
If we do your homework/coding for you, you will learn nothing.

Coming up with the "step-by-step" is your job. That's the point of the exercise. You have to think about the problem and come up with the algorithm that solves it.

Do it on paper, one step at a time, and document precisely what you're doing at each step. If you look at a character to see what it is, you document that as a step.
 
Share this answer
 
Comments
Patrice T 28-Dec-21 12:53pm    
+5
 
Share this answer
 
Quote:
How to convert Roman numerals to Integer in C# without any built-in function and step by step

1) study how roman numerals are built Roman numerals - Wikipedia[^]
2) Get many samples and solve them by hand, you are following rules, they are the basis of your algorithm.
3) Then create your own solution.
 
Share this answer
 
v2
Comments
BillWoodruff 28-Dec-21 1:27am    
voted #1: this reply has no content that might help the OP.
Patrice T 28-Dec-21 2:01am    
Even link to Roman Numerals ?
Difficult to help OP as he clain no problem and just want a full blowup solution with explanation.
BillWoodruff 28-Dec-21 2:46am    
"Difficult to help OP as he clain no problem and just want a full blowup solution with explanation."

So, a statement with no content deserves a solution with no content ?

You are a tourist, lost in a big city: you ask a local for directions to the bank; they reply: " 'bank' is found in the 'B' section of the dictionary." :)
ahmedbelal 28-Dec-21 3:34am    
https://www.dictionary.com/e/roman-numerals/
ahmedbelal 28-Dec-21 3:36am    
Write a C# programming to convert a given roman number to an integer.

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Add the following to your dictionary; then proceed from the left; matching the first 2 chars; if not a match, the first 1 char. Remove the 2 or 1 leading matched chars; repeat the lookup. Add the dictionaries values to get the final result.

CM 900, CD 400, XC 90, XL 40, IX 9, IV 4

MCMLXXXIV = M CM L X X X IV = 1000 + 900 + 50 + 10 + 10 + 10 + 4 = 1984
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900