标签:print 错误 ret == 个人 std turn rand srand
题目来自网络:模仿价格猜测,输入数字猜价格
个人未完成。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int cishu = 0;
int jiage;
int biaozhun;
srand((unsigned) (NULL));
biaozhun = (rand() * rand()) % 59 + 1;
do
{
printf("请输入你猜测的价格:");
scanf("%d",&jiage);
if(biaozhun > jiage)
{
printf("太小了\n");
printf("价格为:%d\n",biaozhun);
cishu++;
}
else if(biaozhun < jiage)
{
printf("太大了\n");
printf("价格为:%d\n",biaozhun);
cishu++;
}
else
{
break;
}
}
while(biaozhun == jiage);
printf("一共猜测%d次,价格为%d",cishu,jiage);
return 0;
}
错误类型:还未找出。继续努力
标签:print 错误 ret == 个人 std turn rand srand
原文地址:https://www.cnblogs.com/allsear/p/10146150.html