Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Rodrigo54
Created July 7, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rodrigo54/2c2ea88f82c8cbe8b756 to your computer and use it in GitHub Desktop.
Save Rodrigo54/2c2ea88f82c8cbe8b756 to your computer and use it in GitHub Desktop.
programa pra desligar pc
#include <stdio.h>
#include <string.h>
int main(){
char tempo[7], comando[24] = {"shutdown -r -t "};
printf("\nInforme o tempo para reiniciar seu computador em segundos :");
scanf("%s",tempo); //strings não precisam de '&' no scanf.
strcat(comando, tempo);
printf("\nO tempo determinado para reiniciar o pc sera de %s segundo(s).\n",tempo);
printf("\nDigite uma teclar para dar inicio a contagem ...");
getch();
system (comando);
printf("\nDentro de %s segundo(s), seu computador será reiniciado.\n",tempo);
system("PAUSE");
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment