刚接触c语言一个月,尝试着写了一个猜数程序,,求大神看看我的程序有什么问题

东西在问题补充

//1.不要用goto语句
//2.为什么要用float ?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand((unsigned)time(NULL));
int s,n;
s=rand()%101;
while(1)
{
system("cls");
printf("      1. play\n");
printf("      0. exit\n");
printf("\n请输入0或1:");
fflush(stdin);
scanf("%d",&n);
if(n!=1 && n!=0)
{
printf("\n输入错误!只能输入0和1, 按任意键继续...\n");
fflush(stdin);
getchar();
continue;
}
if(n==0)
{
printf("\ngoodbye!");
return 0;
}
while(1)
{
printf("\n请输入你猜的码:");
fflush(stdin);
scanf("%d",&n);
if(n==s)
{
printf("\nBingo!");
getchar();
return 0;
}
else if(n>s)
{
printf("\n再小点!\n");
}
else if(n<s)
{
printf("\n再大点!\n");
}
}
}
return 0;
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-10-25
然而并看不到代码啊追问

问题补充里没有嘛?

相似回答