#include <stdio.h>
#include <windows.h>
main()
{
DWORD ver_n =GetVersion();
BYTE *p = (BYTE *)&ver_n;
printf("主版本号: %d\n", *p);
printf("次版本号: %d\n\n", *(p+1));
OSVERSIONINFO os;
os.dwOSVersionInfoSize = sizeof(os);
GetVersionEx((OSVERSIONINFO *)&os);
printf("主版本号: %d\n", os.dwMajorVersion);
printf("次版本号: %d\n", os.dwMinorVersion);
}