OK..... so I don't know if I am on the right track with this.. If someone could please help me out it would be greatly appreciated.
You can either e-mail me at sweetcheeks_18@hotmail.com or post a message.. Thanks
Write a program that converts a number entered in Roman numerals to decimal. Your program should consist of a class, say Roman. An object of the type Roman should do the following:
a. Store the number as a Roman numeral
b. Convert and store the number into decimal
c. Print the number as Roman numeral or decimal number as requested by the user.
The decimal values of the Roman numerals are:
M 1000
D 500
C 100
L 50
X 10
V 5
I 1
CODE
include <iostream>
using namespace std;
class romanType{
public:
void roman();
int convert();
void print();
void get();
private:
int M, D, C, L, X, V, I;
char romanNumeral;
};
void romanType::roman(){
M = 1000;
D = 500;
C = 100;
L = 50;
X = 10;
V = 5;
I = 1;
}
int romanType::convert(){
if (romanNumeral = M){
cout << 1000;
}else if(romanNumeral = D){
cout << 500;
}else if(romanNumeral = C){
cout << 100;
}else if(romanNumeral = L){
cout << 50;
}else if(romanNumeral = X){
cout << 10;
}else if(romanNumeral = V){
cout << 5;
}else if(romanNumeral = I){
cout << 1;
}
return romanNumeral;
}
void romanType::print(){
cout << romanNumeral << endl;
}
void romanType::get(){
}
int main(){
char romanNumeral;
cout << "Welcome to the Roman numeral to decimal converter!\nPlease enter a number in Roman numerals to be converted: ";
cin >> romanNumeral;
//print();
return 0;
}