im new to c++ and have been writing the simple programs that i can in console apps. my hardest, simple program yet has become hard. im trying to make a program that has timed shutdown. ie. you put in 10 minutes, and in 10 minutes your computer will shut off. i have been reading posts on how people have been trying to shut down their computers and all of the replies say that it isn't possible to do it in console mode. is this true? Here is what i have:
#include <windows.h>
#include <iostream.h>
int main()
{
int timelef;
cout<<"How long would you like to wait until you shut down your computer?:"<<endl;
cin>>timelef;
if (timelef<500) {
Sleep(1000*60*timelef);
ExitWindowsEx(); //this is giving me an error, too few arguments
}
if (timelef>500) {
cout<<"Your number is too big"<<endl;
}
int exitme;
cout<<"The program has finished, press a key and Enter to leave"<<endl;
cin>>exitme;
return 0;
}
//where x is the number of milliseconds to "sleep"
//also be sure to capitalize sleep or it won't work i think