#include <iostream>
using namespace std;
class romanType{
public:
romanType(char&);
int convert();
void print();
void get();
private:
int M, D, C, L, X, V, I;
char romanNumeral;
};
romanType::romanType(char &ch){
M = 1000;
D = 500;
C = 100;
L = 50;
X = 10;
V = 5;
I = 1;
cout << ch << endl;
romanNumeral=ch;
}
int romanType::convert(){
switch (romanNumeral) {
case 'M': return 1000;
case 'D': return 500;
case 'C': return 100;
case 'L': return 50;
case 'X': return 10;
case 'V': return 5;
case 'I': return 1;
}
return 0;
}
void romanType::print(){
cout << romanNumeral << endl;
}
void romanType::get(){
}
int main(){
char romanNumeral;
cout << "Please enter a number to convert: ";
cin >> romanNumeral;
romanType roman=romanType(romanNumeral);
cout << roman.convert() << endl;;
system("pause");
return 0;
}
This post has been edited by XodoX: 01 February 2011 - 09:10 PM

New Topic/Question
Reply




MultiQuote




|