bool IsInRange(char ch) { switch ( ch ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a': case 'A': case 'b': case 'B': case 'c': case 'C': case 'd': case 'D': case 'e': case 'E': case 'f': case 'F': case '.': return true ; default: return false ; }
} int main(void) { bool flag = true ; char buffer[20] ; Input(buffer) ; for ( int i = 0 ; i < strlen(buffer) ; i++ ) { if( (flag = IsInRange(buffer[i])) == false ) { cout << "This is not a constant number !" << endl ; break ; } } if( flag == true ) cout << "This is a constant number !" << endl ; return 0 ; }