Roman Numeral Calculator Program

I need to make a program that converts Roman numerals to its decimal numbers. I need to include a function that yields the numeric value of each of the letters, and another function that converts the Roman number string and returns its value as follows: Look at the first two characters of the string. If the first has a larger value than the second, then simply convert the first, call the conversion function again for the substring starting with the second character, and add both values. If the first one has a smaller value than the second, compute the difference and add it to the conversion of the substring starting at the third character.

This is what I did so far, and I don't know if I am doing it right, and what I should do, to successfully make the program.

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<iomanip>
#include<iostream>
#include<string>
using namespace std;

void RomanInitialize();


	void RomanInitialize(){
		int M = 1000;
		int D = 500;
		int C = 100;
		int L = 50;
		int X = 10;
		int V = 5;
		int I = 1;
	}

	int main(){


		cout << " Enter the Roman Numeral Value: ";
		string roman;
		cin >> roman;
		string sub = roman.substr(0, 2);
		cout << sub << endl;
		string Num = sub.substr(0, 1);
		string Numeral = sub.substr(1, 2);


		if (Num > Numeral){
			if (Num == "M"){
				RomanInitialize();
				int M = 1000;
				int D = 500;
				int C = 100;
				int L = 50;
				int X = 10;
				int V = 5;
				int I = 1;
				cout << static_cast<int>(Num + Numeral) << endl;
			}

			
		else if (Numeral > Num){
				cout << "values " << Numeral + Num << endl;
			}
		}
	}


Any help would be appreciated
Thanks
Topic archived. No new replies allowed.