Small programs with automatic shutdown in C language, dedicated for the whole person

Source: Internet
Author: User

Small programs with automatic shutdown in C language, dedicated for the whole person
Interesting little programs for capturing people, suitable for beginners to practice. After you click it on, the computer will automatically shut down after a certain period of time. Enter words like "I am a pig" to end. Otherwise, the shutdown task will remain in the countdown state .. # Include <stdio. h> // function of the standard input/output library # include <stdlib. h> // enter the command # include <string. h> // string. The database function int main () {char a [10] defined in the array; // defines an array of character types, it is easy for players to enter all types of character information from the keyboard. flag: printf ("Please input \" I am pig \ "; otherwise, the computer will be disabled \ n" in one minute "); // The statement "I am a pig" can be freely changed by the setter, but remember to change the system ("shutdown-s-t 60") at the corresponding position "); // 60 seconds countdown shutdown command, the time can be freely changed scanf ("% s", a); // players from the keyboard type string if (strcmp (, "I'm a pig") = 0) {// compare two strings. IF the two strings are equal, execute the statement printf under IF ("Congratulations! You have selected your own Sn and admitted to reality! \ N "); system (" shutdown-a "); // end the automatic shutdown countdown command. Of course, you can also break the rule and cancel this statement, but that would be too evil.} elsegoto flag; // jump to the flag and continue to execute return 0 ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.