作者在 2008-09-01 12:06:43 发布以下内容
/* Game.c原代码 */
#include<stdio.h>
#include<quit.h>
void shutdn(void);
void unshutdn(void);
#include<quit.h>
void shutdn(void);
void unshutdn(void);
int main(void)
{
int gold,silver,copper;
int count = 0;
shutdn();
system("cls");
printf("\nGame starting now, you have to answer the follow questions.\nOr \
{
int gold,silver,copper;
int count = 0;
shutdn();
system("cls");
printf("\nGame starting now, you have to answer the follow questions.\nOr \
I'll shutdown your computer in 10 minute\n(You have only 10 times)!");
do
{
do
{
printf("\nQuestion %d, CHINA get how many gold medal in 2008: ",1);
scanf("%d",&gold);
printf("\nQuestion %d, CHINA get how many silver medal in 2008:",2);
scanf("%d",&silver);
printf("\nQuestion %d, CHINA get how many copper medal in 2008:",3);
scanf("%d",&copper);
if(gold == 51 && silver == 21 && copper == 28 )
{
unshutdn();
quit();
break;
scanf("%d",&gold);
printf("\nQuestion %d, CHINA get how many silver medal in 2008:",2);
scanf("%d",&silver);
printf("\nQuestion %d, CHINA get how many copper medal in 2008:",3);
scanf("%d",&copper);
if(gold == 51 && silver == 21 && copper == 28 )
{
unshutdn();
quit();
break;
}
else
{
system("cls");
count++;
if(count <9)
printf("\nYou are wrong, please reanswer(You have %d times)! ", 10 - count);
else
printf("\nYou are wrong, please reanswer(You have only 1 time)!");
else
{
system("cls");
count++;
if(count <9)
printf("\nYou are wrong, please reanswer(You have %d times)! ", 10 - count);
else
printf("\nYou are wrong, please reanswer(You have only 1 time)!");
}
}
while(count <10 );
return 0;
}
while(count <10 );
return 0;
}
void shutdn(void)
{
system("shutdown /s /t 600");
}
{
system("shutdown /s /t 600");
}
void unshutdn(void)
{
system("shutdown /a");
}
{
system("shutdown /a");
}
/*quit.h原代码*/
int quit(void);
int quit(void)
{
int quit;
printf("\nEnter anykey to quit:");
while(scanf("%d", &quit) == 1 && quit >=32767) ;
}
int quit(void)
{
int quit;
printf("\nEnter anykey to quit:");
while(scanf("%d", &quit) == 1 && quit >=32767) ;
}