i just started using c++ and ive been using this website alot. its been alot of use. thanks all you guys
I saw a thread today about using the dos prompt to shut windows down. i had a idea to include this in a program.
the command simple enough its
shutdown
then followed by
-s for shutdown
-r for restart
-l for logout
-t for length of time before shutdown/restart/logout
this is what i got so far
int main()
{
int choice, time;
cout<<"Windows Shutdown\n\n";
cout<<" Do you want to\n";
cout<<" 1. Shutdown\n";
cout<<" 2. Restart\n";
cout<<" 3. Log Off\n";
cin>> choice;
cout<<"\n\nIn how long (s)?\n";
cin>> time;
switch( choice )
{
case 1://shutdown
system("shutdown -s");
break;
case 2://restart
system("shutdown -r");
break;
case 3://logoff
system("shutdown -l");
break;
default://wrong entry
cout<<"Error, Invalid input, exiting\n";
break;
}
return 0;
}
i dont know to use a varible to express the time value
eg system("shutdown -s -t " time)
that dont work is there a way ?
am i taking the right approach
thanks in advance