Welcome, Guest: Join Nigeria Student Forum / Login / Trending Now / Recent Topics / Hot-Topics🔥 / Jamb News / Campus Gists / Nurses Arena

Search the forum

Stats: 17,953 Members, 73,130 Topics, 15,896 Comments. Date: Sep 15 2019, 3:42 pm

Do you like to own a professional Forum Like this or You want to build something different for your business
Click To 📲 Call

Mathew Oluwaseun
University of Ilorin (Unilorin)
Mechanical Engineering
500Level, Nigeria.
facebook twitter google linkedin

100% Guaranteed: Do you need help on submitting your TMA or you need 30/30 solutions, kindly contact me on
Click To 📲 Call



To shutdown your computer using C program, You'll need to call the system() function which will call the cmd.
stdlib.h contain the system() function and it is used to run any executable file.

C Program Code -

#include
#include
#include
void main()
{
char c;
printf("Do you want to shutdown your PC/Computer (y/n) : ";
scanf("%c",&c);
if(c=='y' || c=='Y')
system("C:\Windows\System32\shutdown /s /t 0";
else
printf("You don't wanna shut down your PC/Computer";
getch();
}


Note - Save the file with .c extension.
/s represents shutdown
/t represents Time means after how much time you wanna shut down your pc. If you will not define the time, By default it will shut down your pc after 30sec.

0 Like

Don not get stuck at the well of argument. Let God be your vindicator. Let Him fight your battles. He will vindicate you better than you can vindicate yourself.

Don't have an account? Use the form below to signup for a Nigeria Student Forum Account




E.g Seuncoded





I agree to the terms of service

Viewing this topic:
1 guest viewing this topic
Download the Ngstudentforum app for Android Devices

Disclaimer: Every Nigeria Student Forum member is solely responsible for anything that he/she posts or uploads on Nigeria Student Forum.
- Copyright © 2016 - 2019. All rights reserved.
For enquiries & feedbacks send email to: Contact-US