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