#include <windows.h>
#include <stdio.h>

int main(){
    SYSTEM_INFO si;
    GetSystemInfo(&si);

    int m_nProcessers = si.dwNumberOfProcessors;
    printf("CPU 核心数目:%d\n", m_nProcessers);
    return 0;
}

获取CPU核心个数_#include