一个C语言猜谜游戏的编程问题
#包含“stdio.h”
# include & lttime.h & gt
# include & ltstdlib.h & gt
虚空猜测(int magic,int guess)
{
静态int c = 0;
c++;
if (magic == guess)
{
printf(" \ n你猜对了!\n您猜了%d次!”,c);
退出(0);
}
if(magic & lt;猜测)
{
printf(" \ n太大了!\ n ");
}
其他
{
printf(" \ n太小了!\ n ");
}
}
int main()
{
int m,n,I;
srand((int)time(0));
n =(rand()% 100)+1;
//printf("n=%d\n ",n);
for(I = 0;我& lt10;i++) {
Printf("请输入你的猜测:");
scanf("%d ",& ampm);
Guess(n,m);
}
返回0;
}