예제 #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: ";
    }
}
예제 #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;
}
예제 #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;
}
예제 #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;
}