#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
void game()
{
int num1 = 0;
int num2 = rand() % 100 + 1;
int m = 1;
while (m <= 10)
{
printf("请猜数字( ̄︶ ̄)↗ ");
scanf("%d", &num1);
if (num1 > num2)
{
printf("大了`(*>﹏<*)′");
}
else if (num1 < num2)
{
printf("小了╥﹏╥...");
}
else
{
printf("猜对啦(^///^)太牛啦");
break;
}
m++;
}
if (m > 10)
{
char arr1[] = "怎么回事小老弟 这猜不对的? 超级无敌大猪(*^_^*)(如果你猜对请忽视这条,技术有限)";
char arr2[] = "******************************************************************************";
int left = 0;
int right = strlen(arr1) - 1;
while (left <= right)
{
arr2[left] = arr1[left];
arr2[right] = arr1[right];
printf("%s\n", arr2);
Sleep(1000);
system("cls");
left++;
right--;
}
}
if (m <= 10)
{
char arr1[] = "恭喜你获得“古希腊掌管猜数字之神”的称号";
char arr2[] = "****************************************";
int left = 0;
int right = strlen(arr1) - 1;
while (left <= right)
{
arr2[left] = arr1[left];
arr2[right] = arr1[right];
printf("%s\n", arr2);
Sleep(1000);
system("cls");
left++;
right--;
}
}
}
void menu()
{
char arr1[] = "加载中 加载中 ";
char arr2[] = "**************";
int left = 0;
int right = strlen(arr1) - 1;
while (left <= right)
{
arr2[left] = arr1[left];
arr2[right] = arr1[right];
printf("%s\n", arr2);
Sleep(1000);
system("cls");
left++;
right--;
}
printf("*******************\n");
printf("******1.play*******\n");
printf("******2.quit*******\n");
printf("*******************\n");
printf("*******************\n");
int input = 0;
}
int main()
{
printf("声明 :本游戏并非原创 只是出于个人 将代码加以组合构成此小游戏s`(*>﹏<*)′");
int input = 0;
srand((unsigned int)time(NULL));
do
{
menu();
printf("请选择*^____^*");
scanf("%d", &input);
switch (input)
{
case 1:
game();
break;
case 0:
printf("退出游戏\n");
break;
default:
printf("重新选择\n");
break;
}
} while (input);
return 0;
}