answersLogoWhite

0

just type these simple lines of code;

note that the code below shuts down the system on execution.

if you would like a user interactive menu then you can just create one

main(){

char y, ans;

printf(would you like to shutdown computer y/n);

scanf("%s", &ans)

;

if(ans == "y"){

system(shutdown -f);

}else{

exit(-1);

}

}

the variable ans is receiving our ans its being compared in the if statement.

hope this works thanks!!!

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

Which of the following are functions of the escape ESC key A shut down your computer B stop a computer virus from entering your computer C stop a function on a program or webpage?

if you go on utube full screen click esc and it will go off fullscreen


What has the author David Spuler written?

David Spuler has written: 'Comprehensive C' -- subject(s): C (Computer program language) 'C++ and C efficiency' -- subject(s): C++ (Computer program language), C (Computer program language)


What has the author Robert C Seacord written?

Robert C. Seacord has written: 'Secure coding in C and C++' -- subject(s): C (Computer program language), C++ (Computer program language), Computer security


What has the author Eric P Bloom written?

Eric P. Bloom has written: 'The Turbo C++ trilogy' -- subject(s): C (Computer program language), C++ (Computer program language), Turbo C (Computer file), Turbo C++ 'Turbo C Plus Plus Trilogy' 'The C trilogy' -- subject(s): C (Computer program language)


What has the author Conor Sexton written?

Conor Sexton has written: 'Newnes C++ pocket book' -- subject(s): C (Computer program language), C++ (Computer program language) 'C pocket book' -- subject(s): C (Computer program language) 'Y2K7'


What has the author Joseph Bergin written?

Joseph. Bergin has written: 'Data structure programming' -- subject(s): C (Computer program language), C++ (Computer program language), Data structures (Computer science), Standard template library 'Data abstraction' -- subject(s): Object-oriented programming (Computer science), C++ (Computer program language), C (Computer program language)


What has the author Steve Schustack written?

Steve Schustack has written: 'C for fun and profit' -- subject(s): C (Computer program language) 'Variations in C' -- subject(s): C (Computer program language) 'C for fun and profit' -- subject(s): C (Computer program language) 'Variations In C Edition'


What has the author Nabajyoti Barkakati written?

Nabajyoti Barkakati has written: 'The Waite Group's Turbo C++ bible' -- subject(s): C (Computer program language), C++ (Computer program language), Turbo C (Computer file), Turbo C++ 'Visual C++ 2 developer's guide' -- subject(s): C++ (Computer program language), Microsoft Visual C++ 'The Waite Group's essential guide to Turbo C' -- subject(s): C (Computer program language), Turbo C (Computer file) 'Programming Windows games with Borland C++' -- subject(s): Borland C++, C++ (Computer program language), Computer games, Windows (Computer programs) 'Borland C++ 4 developer's guide' -- subject(s): Borland C++, C (Computer program language), C++ (Computer program language), Object-oriented programming (Computer science) 'Imaging and animation for Windows' -- subject(s): Computer animation, Computer graphics, Windows (Computer programs) 'Red Hat Linux Secrets Bundle' 'The Waite Group's Quick C Bible' -- subject(s): C (Computer program language), Microsoft QuickC 'UNIX desktop guide to OPEN LOOK' -- subject(s): OPEN LOOK, UNIX (Computer file), User interfaces (Computer systems) 'UNIX Webmaster bible' -- subject(s): UNIX (Computer file), Web servers, Web sites, World Wide Web 'Java Annotated Archives' 'The Waite Group's Microsoft C bible' -- subject(s): C (Computer program language), Microsoft C.


What has the author John Viega written?

John Viega has written: 'Beautiful Security' 'Secure programming cookbook for C and C++' -- subject(s): C (Computer program language), C++ (Computer program language), Computer security, Computer software, Development


What has the author Jeri R Hanly written?

Jeri R. Hanly has written: 'Essential C[plus plus]for engineers and scientists' -- subject(s): C (Computer program language) 'Essential C++ for engineers and scientists' -- subject(s): C++ (Computer program language), C (computer program language)


What are some computer programs that begin with letter c?

Chess Master is a computer program. It begins with the letter c.


Dictionary meaning of shut down?

13.shut down, a. to settle over so as to envelop or darken: The fog shut down rapidly. b. to close, esp. temporarily, as a factory; cease manufacturing or business operations. c. Also, shut down on or upon. Informal. to hinder; check; stop.