Include <cctype> for isdigit().