I want to know how to determine the current OS using C ++ and which service pack is installed
For Windows, see this example under GetOSDisplayString from MSDN, which shows the use of GetVersionEx .
I assume you are writing unmanaged C ++ using Win32? Explore the Win32 GetVersionEx API.
GetVersionEx
Assuming it's for Windows - use GetVersionEx
Perhaps this may be useful: http://msdn.microsoft.com/en-us/library/ak37a69s%28v=VS.90%29.aspx