In software, at runtime, (C++ if it matters), is there a way to find out the maximum level of anisotropic filtering supported by the graphics card?
In general you ask your graphics API you're using.
For example if you're using D3D9 you call IDirect3DDevice9::GetDeviceCaps() and then check the MaxAnisotropy value in the D3DCAPS9 structure.
On almost any reasonably modern graphics card the answer will be 16.
In OpenGL, you would (after creating a context and everything) do this:
GLfloat maxAniso = 0.0f; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
Of course, this only works when the GL_EXT_texture_filter_anisotropic extension is available, but since every graphics card has supported this is about the year 2000, I wouldn't worry about it.