Determine the contents of the following program output:
#define _crt_secure_no_warnings 1#include <stdio.h> #include <stdlib.h>int main () {int i=43; printf ("%d\n", printf ("%d", printf ("%d", I))); System ("pause"); return 0; }
This is a very simple program, which is mainly used in the C language printf output, the program first executes the most internal printf, that is, the output of I as an integer value, the output is 43, and then execute the outside next to the printf, that is, the output 43 of the number of bits 2, Similarly, the outermost printf is executed, and the output 2 has a number of 1 bits, so the final result of the program output is 4321.
"Tease you to play"
Requirements:
Execute the program:
.. Countdown - seconds to shut down the machine ..
show " say you are a pig ! " or shut it down . "..
if the input is " I am a pig " . then cancel the shutdown . ..
If the input is not " I am a pig " . then we don't cancel . ..
The following is a specific procedure:
#include <stdio.h> #include <stdlib.h> #include <string.h>int main () { char write[100]; system ( "shutdown -s -t 60"); / /shutdown command, this 60 is the number of seconds, can be set according to the situation. gt: printf ( "Tell me you're a pig, or you'll shut it down!\n" ) scanf ( "%s", write); if (strcmp (write, "I am a Pig" ) == 0) // STRCMP is a string comparison function { printf ( "Haha, you are pig ~\n" ); &nbSp; system ( "shutdown -a"); } else { printf ( "Don't say it, don't say it.!\n" ); goto gt; //goto statement, The program jumps to the place with the GT logo for execution } return 0;}
This article is from the "unintentional persistent" blog, please be sure to keep this source http://10740590.blog.51cto.com/10730590/1706033
Interesting C language Applet