hello their
i have a string and i want to check if it has only the following characters
MCDLXVI
if anythings else is present (including a space)an error message is displayed.
i've tried the following but it doesn't work
thanks in advance!!!!
i have a string and i want to check if it has only the following characters
MCDLXVI
if anythings else is present (including a space)an error message is displayed.
i've tried the following but it doesn't work
Code:
for( int n = roman.size()-1 ; n>= 1 ; n -- ){
if (roman[n]!= 'M' && roman[n]!= 'C' && roman[n]!= 'D' && roman[n]!= 'L' &&
roman[n]!= 'X' && roman[n]!= 'V' && roman[n]!= 'I'){
cout<<"not a roman numeral"<<endl;
}
}
thanks in advance!!!!