#include <Windows.h>
#include <iostream>
usingnamespace std;
int main()
{
while (true)
{
SYSTEM_POWER_STATUS status;
GetSystemPowerStatus(&status);
int life = status.BatteryLifePercent;
cout << "Battery staus is:";
if (life <= 20) // i want this if % is less than or equal to 20
{
cout << " low, your should consider charging your battery" << endl;
Sleep(10000);
continue;
}
elseif (life >= 50 <= 79) // i want this if % is greater than or equal to 50 and less than or equal to 79
{
cout << " ok, should still consider charging your battery" << endl;
Sleep(10000);
continue;
}
elseif (life >= 80 <= 99) // i want this if % is greater than or equal to 80 and less than or equal to 99
{
cout << " average, shouldnt need to charge your battery" << endl;
Sleep(10000);
continue;
}
elseif (life == 100); // i want this if % is egual to 100
{
cout << " great, battery is full" << endl;
Sleep(10000);
continue;
}
}
}