Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- int s;
- int x, cifras, buffer, tiempo;
- char apagar[50] = "shutdown /s /t ";
- char apagar_2[20] = "";
- do{
- system("cls");
- printf("Apagar PC 1.0\nAutor: @nRikee93\n\nElige:\n1.Apagar\n2.Cancelar apagado.\n_");
- scanf("%d",&s);
- } while (s==1&&s==2);
- if(s==1){
- do{
- system("cls");
- printf("Apagar PC 1.0\nAutor: @nRikee93\n\nElige el retardo:\n1.Un minuto\n2.Diez minutos\n3.Media hora\n4.Una hora\n5.Dos horas\n6.Cinco horas\n7.Personalizado\n 0.Cancelar\n\n_");
- scanf("%d",&s);
- } while(s<0||s>7);
- switch(s)
- {
- case 1: system("shutdown /s /t 60");
- break;
- case 2: system("shutdown /s /t 600");
- break;
- case 3: system("shutdown /s /t 1800");
- break;
- case 4: system("shutdown /s /t 3600");
- break;
- case 5: system("shutdown /s /t 7200");
- break;
- case 6: system("shutdown /s /t 18000");
- break;
- case 7:
- printf("Horas: ");
- scanf("%d",&buffer);
- tiempo = buffer*3600;
- printf("Minutos: ");
- scanf("%d",&buffer);
- tiempo = tiempo+buffer*60;
- printf("Segundos: ");
- scanf("%d",&buffer);
- tiempo = tiempo+buffer;
- // Numero de cifras
- x=0;
- cifras=1;
- while ( ((int)(tiempo/pow(10,x)))!=0 ) x++;
- cifras = x;
- // Asignar
- x=0;
- while( cifras-x!=0){
- apagar_2[cifras-x-1]= 48 + ((tiempo%(int)pow(10,x+1))/((int)pow(10,x)));
- x++;
- }
- strcat(apagar,apagar_2);
- system(apagar);
- case 8: break;
- }
- }
- if(s==0||s==2){
- system("shutdown /a");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement