急!急!哪位大侠帮我改一下C语言猜数游戏

来源:百度知道 编辑:UC知道 时间:2024/06/01 13:00:43
#include <stdio.h>
#include<stdlib.h>
#include<ctype.h>
main()
{
int count;
int number;
int guess;
char yes='Y';
clrscr();
printf("\nNow let us play the game.\n Guess the number:");
while (toupper(yes)=='Y')
{
count=0;
randomize();
number=random(100)+1;
do
{
do
{
printf("\nInput an integer number(1~100):");
scanf("%d",&guess);
}while(!(guess>=1&&guess<=100));
if (guess<number)
printf("\n Your answer is low,try again!");

if (guess>number)
printf("\n Your answer is high,try again!");

count++;
if (count==15)
{
printf("\n This is the %d times! Think it hard next!",count);
}
}while (!(guess==number));
if (count<=7)
{
printf("\n You have got

#include <stdio.h>//不保证对
#define T 0 //正确
#define L 1 //错误 低了
#define H 2 //高了

void print_jg(int j, int i); //输出结果
int pandang(int d,int g); //判断是否正确
int hard(int i); //难度
int guess(); //猜
int leave();//选择是否离开
main()
{
int i, d,g,count,hd,first,lev,cnt;

cnt=i=d=g=count=0;
lev=first=1;

while(first||lev){
cnt=0;
if(count%5==0)++hd;
beagin();
d=hard(hd);

p=T;lev=H;
while(lev!=T&&p!=T ){
g=guess();
p=pandang(g);
print_jg(p,cnt);
lev=leave();
}
++count;
}
}

void print_jg(int p,int cnt){
char c;
if(p==T)c="ture";
else if(p==L)c="low";
else c="high";
printf("you is %s in %d times\n",c, cnt);
}

int pandang(int g,int d){
if(g<d) return L;
else if(g==d)return T;
else r