Ejemplo n.º 1
0
int main() {
    RNInterpreter interpreter;
    char input[20];
    cout << "Enter Roman Numeral: ";

    while (cin >> input) {
        cout << "    interpretation is " << interpreter.interpret(input) << endl;
        cout << "Enter Roman Numberal: ";
    }
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]) {
  RNInterpreter interpreter;
  char input[20];
  cout << "Enter Roman Numberal: ";
  while(cin >> input){
    cout << "     interpretation is " << interpreter.interpret(input) << endl;
    cout << "Enter Roman Numberal: ";
  }
  return 0;
}
Ejemplo n.º 3
0
int RNInterpreter::interpret(char *input)
{
    int total;
    total = 0;
    thousands->interpret(input, total);
    hundreds->interpret(input, total);
    tens->interpret(input, total);
    ones->interpret(input, total);
    if (strcmp(input, ""))
        // if input was invalid, return 0
        return 0;
    return total;
}
Ejemplo n.º 4
0
int RNInterpreter::interpret(char* input) {
    int total = 0;
    thousands->interpret(input, total);
    hundreds->interpret(input, total);
    tens->interpret(input, total);
    ones->interpret(input, total);

    if (strcmp(input, "")) {
        return 0;
    }

    return total;
}