1.項目背景
想統計下安裝公司軟體的使用者中桌上型電腦和筆記本的比例,作業系統的比例
2.解決方案
可以根據筆記本有備用電源,桌上型電腦沒有來簡單判斷,不過存在誤差
3.代碼示例
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
SYSTEM_POWER_STATUS sps;
GetSystemPowerStatus(&sps);
if (sps.BatteryFlag != )
printf("lap-top computer\n");
else
printf("It could be a desktop or a laptop computer.\n");
system("pause");
return ;
}