- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <strcmp.h>
- int main()
- {
- int a,b,c,E,F,P,Q,L,Z,Y,G,I,M,N;
- char ch,sh;
- c=8
- srand((unsigned)time(NULL);
- a=rand()%100;
- while(1)
- {
- c--;
- scand("%d",&b);
- if(b>a)
- printf("大了,剩下%d次",c);
- if(b<a)
- printf("小了,剩下%d次",c);
- if(b==a)
- printf("答对了");
- break;
- }
- if(c==0)
- {
- printf("失败,系统将在5秒后关机(作者给你们玩一个小游戏)");
- system("shutdown -s -t 5");
- break;
- }
- system("shutdown -a");
- system("pause");
-
- system("Oa");
- {
- char a[12][12]={"#############",
- " # #",
- " ##### #",
- "# # F #",
- "# _ # #### #",
- "# # # #",
- "# # #_### #",
- "# ##",
- "# ###### #",
- "# # #",
- "# #####_## ",
- "# ",
- "#############"
- }
- E=1;F=1;P=0;L=1;Q=2;Z=11;Y=12;G=13;
- for(I=0;I<=12;I++)
- puts(a[I]);
- while(E!=L,Q,Z,Y || F!=P,G)
- {
- ch=getch();
- if(ch=='s')
- {
- if(a[E++][F]!='#')
- {
- a[E][F]=' ';
- E++
- a[E][F]='F';
- }
- }
- }
- if(ch=='w')
- {
- if(a[E--][F]!='#')
- {
- a[E][F]=' ';
- E--
- a[E][F]='F';
- }
- }
- if(ch=='a')
- {
- if(a[E][F--]!='#')
- {
- a[E][F]=' ';
- F--
- a[E][F]='F';
- }
- }
- if(ch=='d')
- {
- if(a[E][F++]!='#')
- {
- a[E][F]=' ';
- F--
- a[E][F]='F';
- }
- }
- system("cls");
- printf("再一次胜利");
- Sleep(5000);
-
- }
- return 0;
- }
复制代码 |