#include<stdio.h>
int main()
{
int number
, n
;
int inp
;
int finished
= 0;
int cnt
= 0;
printf("请依次输入你想猜的数字与猜的次数:\n");
scanf_s("%d %d", &number
, &n
);
printf("请开始猜数字:\n");
do
{
scanf_s("%d", &inp
);
cnt
++;
if (inp
<0)
{
printf("Game over!\n");
finished
= 1;
}
else if (inp
>number
)
{
printf("Too big\n");
}
else if (inp
<number
)
{
printf("Too small\n");
}
else
{
if (cnt
==1)
{
printf("Bingo!\n");
}
else if (cnt
<=3)
{
printf("Lucky you!\n");
}
else
{
printf("Good guess!\n");
}
finished
= 1;
}
if (cnt
==n
)
{
if (!finished
)
{
printf("Game over\n");
finished
= 1;
}
}
} while (!finished
);
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-33415.html